当前位置: 首页 > 工具软件 > MacPorts > 使用案例 >

MacPorts使用

史超英
2023-12-01

1.Mac Port中第三方软件下载包存放的默认路径是:/opt/local/var/macports/distfiles/
为了提高安装速度,可以在安装新port时直接将此目录下的文件拷贝到新的Mac Port相同的目录中就可以避免Port去网上下载。

2.使用Mac Port前应该首先更新Port的index
输入: $ sudo port -v selfupdate (强烈推荐第一次运行的时候使用-v参数,显示详细的更新过程)

3.查看Mac Port中当前可用的软件包及其版本 输入: $ port list

4.查看有更新的软件以及版本 输入: $ port outdated

5.升级可以更新的软件 输入: $ sudo port upgrade outdated

6.在Mac Port搜索需要安装的软件包 输入: $ port search maven

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
HuiMinmatoMacBook-Pro:Downloads zikercn$ port search maven
maven @1.0.2 (java, devel)
     stub port, use maven1 instead
 
maven-ant-tasks @2.1.3 (devel, java)
     Use many of Maven's artifact handling features from Ant.
 
maven1 @1.1 (java, devel)
     A java-based build and project management environment.
 
maven2 @2.2.1 (java, devel)
     A java-based build and project management environment.
 
maven3 @3.0.4 (java, devel)
     A java-based build and project management environment.
 
maven_select @0.3 (sysutils)
     common files  for  selecting default Maven version
 
Found 6 ports.

7.搜索到需要安装的软件包之后,如何查看具体的软件包的内容和说明
输入: $ port info maven3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
maven3 @3.0.4 (java, devel)
 
Description:          Maven is a Java project management and project
                       comprehension tool. Maven is based on the concept of a
                       project object model (POM)  in  that all the artifacts
                       produced by Maven are a result of consulting a well
                       defined model  for  your project.Builds, documentation,
                       source  metrics, and  source  cross-references are all
                       controlled by your POM. Maven 3 aims to ensure backward
                       compatibility with Maven 2, improve usability, increase
                       performance, allow safe embedding, and pave the way to
                       implement many highly demanded features.
Homepage:             http: //maven .apache.org/
 
Build Dependencies:   kaffe
Runtime Dependencies: maven_select
Platforms:            darwin
License:              unknown
Maintainers:          blair@macports.org, gk5885@kickstyle.net

8.查看即将安装的或者已经安装的软件包的依赖关系
输入: $ port deps maven3

1
2
3
Full Name: maven3 @3.0.4_0
Build Dependencies:   kaffe
Runtime Dependencies: maven_select

9. 查看安装时允许客户定制的参数 输入: $ port variants maven3

1
maven3 has no variants

10.查看了软件包的内容和说明,并确认确实要安装,则输入: $ sudo port install maven3

1
2
3
4
5
6
7
To  make  maven 3.0.4 the default, please run
     sudo  port  select  -- set  maven maven3
 
--->  Cleaning maven3
--->  Updating database of binaries: 100.0%
--->  Scanning binaries  for  linking errors: 100.0%
--->  No broken files found.

11. 卸载已经用Mac Port安装的软件 输入: $ sudo port uninstall maven3

1
2
3
4
--->  Deactivating maven3 @3.0.4_0
--->  Cleaning maven3
--->  Uninstalling maven3 @3.0.4_0
--->  Cleaning maven3

MacPorts卸载删除


1.卸载原有的MacPorts(如果你没有安装,直接跳过这一步,输入: $ port version 查看)
#原版使用MacPorts安装过的软件在/opt/local目录下,删除之前最好查看下,心里有个数.

1
2
3
4
5
6
7
8
9
10
11
12
sudo  port -f uninstall installed
sudo  rm  -rf  [/加下面的每条]
/opt/local
/Applications/DarwinPorts
/Applications/MacPorts
/Library/LaunchDaemons/org .macports.*
/Library/Receipts/DarwinPorts *.pkg
/Library/Receipts/MacPorts *.pkg
/Library/StartupItems/DarwinPortsStartup
/Library/Tcl/darwinports1 .0
/Library/Tcl/macports1 .0
~/.macports
 类似资料: