習慣mac . OS X 安裝MacPorts


1. 安裝必要的軟件

安裝MacPorts需要先安裝X11和Xcode,Lion系統已經默認安裝好了X11,在Appstore里安裝Xcode即可。

下載完Xcode之后,一般路徑在/Application下,可以先將其拷出來,以備后續使用:

$ cp -a /Application/Xcode.app ~/soft

 

2. 安裝MacPort,並安裝

下載地址:https://distfiles.macports.org/MacPorts/,可以直接下載Lion下的最新版:https://distfiles.macports.org/MacPorts/MacPorts-2.1.1-10.7-Lion.pkg

如果MacPort出現新版本,可以直接通過如下命令進行更新:

$ sudo port -v selfupdate

添加MacPort到環境變量,vi ~/.bash_profile

export PATH=${PATH}:/opt/local/bin:/opt/local/sbin:/opt/local/share/man

 

3. 比如安裝bash的自動補全軟件:

$ sudo port install bash-completion

Error: No valid Xcode installation is properly selected.

Error: Please use xcode-select to select an Xcode installation:

Error:     sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer # version 4.3.2

Error:     sudo xcode-select -switch /Users/zhaobinjie/soft/Xcode.app/Contents/Developer # version 4.3.2

錯誤解決方法,1)設置xcode-select的路徑,2)安裝命令行工具:

$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

You can get Xcode from the Mac App Store as a free download. From within that (in the preferences | downloads) you can download and install the command line tools.

 

4. MacPort常用操作

查詢安裝的ports

$ port -qv install

當安裝新的系統時,卸載安裝的ports

$ sudo port -fp uninstall --follow-dependents installed

清除所有局部的構建

$ sudo port clean all

安裝必須的ports

$ sudo port install portname +variant1 +variant2 …

 

5. 刪除MacPorts:

#原版使用MacPorts安裝過的軟件在/opt/local目錄下,刪除之前最好查看下,心里有個數.

$ 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

 

Reference:

http://stackoverflow.com/questions/9904326/warning-the-command-line-tools-for-xcode-dont-appear-to-be-installed-most-por

http://www.macports.org/install.php

http://hi.hiing.net/2011/06/use-homebrew-package-management.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM