[Mac][转] ports命令
安装路径:/opt/local/lib/
常用命令
port -d selfupdate #升级macport, 如同:cd /usr/ports && make update
port install xxx #安装xxx软件, 如同:cd /usr/ports/kkk/xxx && make install
port upgrade outdated #升级所有已过时的软件,作用如portupgrade -a
port installed #列出已经安装的软件,如pkg_info
port search xxx #列出与xxx条件相符的软件,如cd /usr/ports/ && make search name=xxx
Mac Port 基本用法总结
来自:guibin.beijing@gmail.com
1. Mac Port的下载地址
http://www.macports.org/install.php
2. Mac Port的说明文档
3. Mac Port中第三方软件下载包存放的默认路径是
/opt/local/var/macports/distfiles/
为了提高安装速度,可以在安装新port时直接将此目录下的文件拷贝到新的Mac Port相同的目录中就可以避免Port去网上下载。
4. 使用Mac Port前应该首先更新Port的index
$ sudo port selfupdate
引用
Password:
Warning: port definitions are more than two weeks old, consider using selfupdate
---> Updating the ports tree
---> Updating MacPorts base sources using rsync
MacPorts base version 1.9.2 installed,
MacPorts base version 1.9.2 downloaded.
---> MacPorts base is already the latest version
The ports tree has been updated. To upgrade your installed ports, you should run
port upgrade outdated
5. 查看Mac Port中当前可用的软件包及其版本
$ port list
引用
rabbitmq-server @2.4.0 net/rabbitmq-server
AppHack @1.1 aqua/AppHack
AppKiDo @0.985 aqua/AppKiDo
AquaLess @1.6 aqua/AquaLess
ArpSpyX @1.1 aqua/ArpSpyX
AssignmentTrackerX @2.0beta3.1 aqua/AssignmentTrackerX
BigSQL @1.0 aqua/BigSQL
BiggerSQL @1.3.9 aqua/BiggerSQL
Books @3.2.5c aqua/Books
......
6. 在Mac Port如何搜索需要安装的软件包?
$ port search maven
maven @1.0.2 (java, devel)
A java-based build and project management environment.
maven-ant-tasks @2.0.10 (devel, java)
Use many of Maven's artifact handling features from Ant.
maven2 @2.2.1 (java, devel)
A java-based build and project management environment.
maven3 @3.0.3 (java, devel)
A java-based build and project management environment.
maven_select @0.3 (sysutils)
Switch the default Maven java build tool
Found 5 ports.
7. 搜索到需要安装的软件包之后,如何查看具体的软件包的内容和说明?
$ port info maven2
maven2 @2.2.1, Revision 3 (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 2.0 is a complete rewrite of Maven 1.0 and as such is better
organized, faster and easier to use.
Homepage: http://maven.apache.org/
Build Dependencies: kaffe
Library Dependencies: maven_select
Platforms: darwin
License: unknown
Maintainers: blair@macports.org, gk5885@kickstyle.net
8. 查看即将安装的或者已经安装的软件包的依赖关系
$ port deps maven2
Full Name: maven2 @2.2.1_3
Build Dependencies: kaffe
Library Dependencies: maven_select
9. 查看安装时允许客户定制的参数
$ port variants maven2
maven2 has no variants
10. 查看了软件包的内容和说明,并确认确实要安装,则
$ sudo port install maven2
11. 安装完毕之后,清除安装时产生的临时文件
$ sudo port clean --all maven2
---> Cleaning maven2
12. 卸载已经用Mac Port安装的软件
sudo port uninstall maven2
port常用命令列表
help
selfupdade
sync
list
search
info
deps
variants
install
clean
uninstall
contents
installed
outdated
upgrade
dependents
help
help通常用来查看某个指令的帮助说明
port help selfupdate
selfupdate
同步本地和全球的软件树,有必要时,同时升级mac port自己.
sudo port selfupdate
sync
同步本地和全球的ports tree,但不检查自己是否有更新.
sudo port sync
list
列出当前所有的可用软件,如果想查找是否有自己想要的软件时,还是使用search指令方便一些.
port list
search
模糊搜索,可以匹配软件名字和描述,还有更高级的用法,具体看port help search
port search rrd
info
查看一款软件的详细信息
port info flowd
deps
查看一款软件的依赖关系
port deps apache2
variants
在安装软件前,用这个命令查看软件是否有多个版本.再选择安装一个合适的版本.
port variants nmap
install
安装软件命令,安装前最好使用variants命令查看是否有多个不同版本.
sudo port install nmap
clean
删除一些编译软件时留下的临时文件.
port clean --all vile
uninstall
卸载软件命令
如果这个软件依赖与另外的一款软件,默认不删除它依赖的软件,
使用参数 -f (force) 可以强行删除它依赖的软件.
port -f uninstall vile
contents
显示软件安装后的文件列表.
port contents xorg-renderproto
installed
列出全部或者指定的已经安装的软件.
port installed
port -v installed atlas
outdated
查看已经安装的软件是否有更新,在执行这个指令前,先执行selfupdate 或者 sync更新软件树
upgrade
更新软件,默认一起更新它依赖的所有软件,如果想不更新它依赖的软件,使用 -n 参数
默认不删除旧软件版本,只是使旧软件变成无效状态,如果想要一起删除旧软件,使用 -u 参数
port upgrade gnome
port -n upgrade gnome
更新所有的可更新软件
port upgrade outdated
更新软件同时删除旧版本软件
port -u upgrade vile
dependents
查看哪些软件时依赖与这个软件的.删除一个软件时候,最好先执行一下这个命令.
port dependents openssl