【转载】[OS X笔记]安装MacPorts
【轉載】http://weimenlove.blog.163.com/blog/static/1777547320124282192310/
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
轉載于:https://www.cnblogs.com/oracoo/archive/2012/07/08/2581798.html
總結
以上是生活随笔為你收集整理的【转载】[OS X笔记]安装MacPorts的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#委托-委托不关心被封装的类
- 下一篇: wcf——WSDL