mac软件管理工具──MacPorts

2012年11月4日 发表评论 阅读评论

Linux之所以如此流行,其原因之一就是其方便的软件管理,如yum、apt-get等。而Mac下面常用的安装方式为通过dmg、pkg包进行安装,作为unix的分支的Mac OS下面有没有apt-get、yum一样方便的软件管理工具呢?答案是肯定的,这就是本便要介绍的macports ,其同BSD中的ports用法几乎一样。

其官方网站为:http://www.macports.org/install.php,这里提供有dmg安装、pkg安装和源码安装三种方式,dmg和pkg就不多说了,下载完成后,下一步下一步安装即可。目前的最新版本为2.1.2 。源码下载地址为: https://distfiles.macports.org/MacPorts/  。

源码安装具体步骤如下:

wget http://distfiles.macports.org/MacPorts/MacPorts-2.1.2.tar.gz
tar zxvf MacPorts-2.1.2.tar.gz
cd MacPorts-2.1.2
./configure && make && sudo make install
cd ../
rm -rf MacPorts-2.1.2*

其安装完成后,默认路径为/opt/local 。因些如果想直接使用该命令,需要通过设置$PATH生效。如下:

vim /etc/profile
export PATH=/opt/local/bin:$PATH
export PATH=/opt/local/sbin:$PATH

MacPorts使用
更新ports tree和MacPorts版本,强烈推荐第一次运行的时候使用-v参数,显示详细的更新过程。

sudo port -v selfupdate

搜索索引中的软件

port search name

安装新软件

sudo port install name

卸载软件

sudo port uninstall name

查看有更新的软件以及版本

port outdated

升级可以更新的软件

sudo port upgrade outdated

以wget的安装为例,如下:

macmatoMacBook-Pro:bin yang$ sudo port -v selfupdate
Password:
--->  Updating MacPorts base sources using rsync
receiving file list ... done
sent 36 bytes  received 69 bytes  30.00 bytes/sec
total size is 3543040  speedup is 33743.24
receiving file list ... done
sent 36 bytes  received 76 bytes  24.89 bytes/sec
total size is 512  speedup is 4.57
MacPorts base version 2.1.2 installed,
MacPorts base version 2.1.2 downloaded.
--->  Updating the ports tree
Synchronizing local ports tree from rsync://rsync.macports.org/release/tarballs/ports.tar
receiving file list ... done
sent 36 bytes  received 70 bytes  23.56 bytes/sec
total size is 54691840  speedup is 515960.75
receiving file list ... done
sent 36 bytes  received 77 bytes  25.11 bytes/sec
total size is 512  speedup is 4.53
Creating port index in /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports
Total number of ports parsed:	0
Ports successfully parsed:	0
Ports failed:			0
Up-to-date ports skipped:	15923
--->  MacPorts base is already the latest version
The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated
macmatoMacBook-Pro:bin yang$ port search wget
gwget @1.0.4 (gnome, net)
    Gwget is a Download Manager for Gnome 2. It uses wget as a backend.
wget @1.14 (net, www)
    internet file retriever
wgetpro @0.1.3 (net, www)
    advanced internet file retriever
wput @0.6.2 (net)
    wput is like wget but is for uploading files to ftp-servers
Found 4 ports.
macmatoMacBook-Pro:bin yang$ sudo port install wget
--->  Computing dependencies for wget
--->  Dependencies to be installed: gettext expat libiconv ncurses gnutls libgcrypt libgpg-error libtasn1 lzo2 readline libidn
--->  Fetching archive for expat
--->  Attempting to fetch expat-2.1.0_0.darwin_10.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/expat
--->  Attempting to fetch expat-2.1.0_0.darwin_10.x86_64.tbz2.rmd160 from http://mse.uk.packages.macports.org/sites/packages.macports.org/expat
--->  Installing expat @2.1.0_0
--->  Activating expat @2.1.0_0
--->  Cleaning expat
--->  Fetching archive for libiconv
--->  Attempting to fetch libiconv-1.14_0.darwin_10.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/libiconv
………………

Eclipse的插件需要subclipse需要JavaHL,下面通过MacPorts来安装

sudo port install subversion-javahlbindings

注:MacPorts的安装需要xcode的支持,xcode for mac os x 10.6.5的下载地址




本站的发展离不开您的资助,金额随意,欢迎来赏!

You can donate through PayPal.
My paypal id: itybku@139.com
Paypal page: https://www.paypal.me/361way

分类: Linux/unix/mac 标签:
  1. 本文目前尚无任何评论.