幾乎所有的人都在講macports,或者用port方式安裝。我暈。
MacPorts version 2.1.1 is available in various formats for download and installation (note, if you are upgrading your Mac OS X to a new major release, see the migration info page):
“pkg” installers for Lion and Snow Leopard, for use with the Mac OS X Installer.
This is the simplest installation
procedure that most users should follow after meeting the requirements listed
below. Installer for legacy platform Leopard
also available.
In source form as either a tar.bz2 package or a
tar.gz one for manual compilation, if you intend to customize your installation
in any way.
SVN checkout of the unpackaged sources, if you wish to follow MacPorts development.
The selfupdate target of the port(1) command, for users who already have
MacPorts installed and wish to upgrade to a newer release.
Checksums for our packaged downloads are contained in the corresponding checksums file.
Please note that in order to install and run MacPorts on Mac OS X, your system must have installations of the following
components:
Apple's Xcode Developer Tools (version 4.1 or later for Lion,
3.2 or later for
Snow Leopard, or 3.1 or later for Leopard), found at the Apple Developer Connection
site, on your Mac OS X installation CDs/DVD, or in the Mac App Store. Using the latest available version that will run on your
OS is highly recommended.
Ensure that the optional components for command line development are installed
("UNIX Development", plus "System Tools", or "Command Line Tools" in newer versions, or "Command Line Support" in older ones).
The X11 windowing environment (A.K.A. “X11 User”)
for ports that depend on the functionality it provides to run.
The “X11 User” package is an optional installation on your system CDs/DVD for
Tiger, enabled through the “Customize” button of the installer, whereas it is included by default
on Leopard and newer.
You can use the xorg-server port instead of Apple's X11.app if you wish.
黑黑,但不是這樣就完事了,安裝完了怎麼用呢?
1. 升级MacPorts:
%% sudo port selfupdate
也可用debug模式进行:
%% sudo port -d selpupdate
2. 列出可用ports软件:
%% sudo port list
这个列表会很长,会列出所有可用的软件,大概有3~4万个,可以导入txt文档里面看。实际上MacPorts的官网上也可以查看。
3. 搜索带有关键词信息的软件列表:
%% sudo port search software_name
4. 搜索到软件的具体名字,就可以用info命令查询所需软件信息:
%% sudo port info software_name
5. 用deps命令查看软件依赖性:
%% sudo port deps software_name
6. 在安装软件前,用variants命令查看本地可用的已安装软件包:
%% sudo port variants software_name
7. 安装软件software_name:
%% sudo port install software_name
8. clean命令清理安装过程中的缓存文件,在获取软件失败时也可以使用:
%% sudo port clean --all software_name
9. 卸载软件
9.1. uninstall命令卸载软件:
%% sudo port uninstall software_name
9.2. 递归卸载要卸载的软件所依赖的软件包:
%% sudo port uninstall --follow-dependencies software_name
但这一命令不会卸载那些又依赖其他软件包的软件。
9.3. 在卸载软件software_name前,先卸载它所依赖的所有ports可以用以下命令:
%% sudo port uninstall --follow-dependents
9.4. 强制卸载软件,忽略依赖性关系。
%% sudo port -f uninstall
除非你很确定这一动作,否则不要乱尝试。
10. contents命令可以查看已经安装的port软件
%% port contents software_name
11. 查看已安装软件的信息:
11.1. 查看软件software_name的版本、变量、使用状态等信息,如果没有指定port名字,则默认会列出所有已安装ports的信息:
%% sudo port installed software_name
11.2. 用-v选项查看更多的信息,包括平台、CPU架构等信息:
%% sudo port -v installed software_name
12. 查看已安装的ports是否有更新,及列出可升级软件列表:
%% sudo port outdated
这里要注意的是,在使用这个命令之前需要使用selfupdate命令更新MacPort本身。
13. 使用upgrade命令升级软件:
13.1. 升级软件并且同时升级所依赖的软件包:
%% sudo port upgrade software_name
13.2. 升级软件,但不升级依赖包:
%% sudo port -n upgrade software_name
13.3. 升级所有可升级软件:
%% sudo port upgrade outdated
14. upgrade命令默认会在升级软件的同时继续保留旧版本。如果希望在升级到新版本的同时卸载老版本,则执行:
%% sudo port -u upgrade software_name
15. dependents命令将报告所查询软件的依赖包情况。
%% port dependents software_name
MacPorts在安装软件时会同时获取软件的依赖树信息,因此在卸载软件时会报告依赖情况。
16. livecheck命令检查软件software_name是否已经被用户通过下载软件包手动安装了:
%% port livecheck software_name
如果要获取更多的信息,可以使用debug模式。这对于MacPorts的维护者相当有用。