MacPorts为简化软件的编译、安装、升级而生。
- MacPorts就像apt-get、yum一样,可以快速安装些软件
The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac operating system. 来自MacPorts
1.下载安装包
官网下载地址www.macports.org/install.php
下载你相应的系统即可。
2.安装卡顿杀掉进程
解决方案在这里
3.换源
- 找到源配置文件 /opt/local/etc/macports/sources.conf
# MacPorts system-wide configuration file for ports tree sources.
#
# To change how MacPorts fetches base, see rsync_server and rsync_dir in
# macports.conf.
# To add a local source, add a "file://" entry.
#
# Example: file:///Users/landonf/misc/MacPorts/ports
#
# To prevent a source from synchronizing when `port sync` is used,
# append "[nosync]" at the end.
#
# Example: file:///Users/landonf/misc/MacPorts/ports [nosync]
#
# Note that MacPorts parses source URLs in order; when a port appears in
# multiple sources, it installs the first occurrence. For local sources
# to shadow remote ones, "file://" URLs must come before other URLs.
# A list of rsync mirrors is available at
# https://trac.macports.org/wiki/Mirrors#Portfiles.
#
# If an "rsync://" URL points to a .tar file, a signed .rmd160 file must
# exist in the same directory on the server and will be used to verify
# its integrity.
#
# For proper functionality of various resources (port groups, mirror
# sites, etc.), the primary MacPorts source must always be tagged
# "[default]", even if switched from the default "rsync://" URL.
# rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default]
rsync://pek.cn.rsync.macports.org/macports/release/tarballs/ports.tar [default]
我添加了清华的镜像源。
4.更新
sudo port -v selfupdate
成功的日志
sudo port -v selfupdate
Password:
---> Updating MacPorts base sources using rsync
Willkommen auf dem RSYNC-server auf ftp.fau.de.
Nicht all unsere Mirror sind per rsync verfuegbar.
Welcome to the RSYNC daemon on ftp.fau.de.
Not all of our mirrors are available through rsync.
receiving file list ... done
sent 16 bytes received 55 bytes 6.76 bytes/sec
total size is 85712384 speedup is 1207216.68
Willkommen auf dem RSYNC-server auf ftp.fau.de.
Nicht all unsere Mirror sind per rsync verfuegbar.
Welcome to the RSYNC daemon on ftp.fau.de.
Not all of our mirrors are available through rsync.
receiving file list ... done
sent 16 bytes received 62 bytes 12.00 bytes/sec
total size is 512 speedup is 6.56
MacPorts base version 2.6.2 installed,
MacPorts base version 2.6.2 downloaded.
---> Updating the ports tree
Synchronizing local ports tree from rsync://pek.cn.rsync.macports.org/macports/release/tarballs/ports.tar
+==================================================+
| Tsinghua University |
| -= Open Source Mirror Site =- |
+--------------------------------------------------+
| Welcome to Tsinghua Open Source Mirror Site. |
| |
| This mirror is also available on HTTP. |
| HTTP [https://mirrors.tuna.tsinghua.edu.cn] |
| RSYNC [rsync://mirrors.tuna.tsinghua.edu.cn] |
| |
| If you have any issues, please contact us |
| via GitHub @ https://github.com/tuna/issues |
| or IRC at #tuna on freenode |
| or Fishroom at https://fishroom.tuna.moe/ |
| |
| Supported by |
| Tsinghua Information Technology Center |
| Maintained by |
| Tsinghua University TUNA Association |
| Service Provided by |
| nanomirrors |
| |
+==================================================+
Note: This service is provided with a modified
version of rsync. For detailed information, please
visit: https://github.com/tuna/rsync
receiving file list ... done
./
ports.tar
ports.tar.rmd160
sent 112 bytes received 83348593 bytes 1089525.56 bytes/sec
total size is 83313664 speedup is 1.00
+==================================================+
| Tsinghua University |
| -= Open Source Mirror Site =- |
+--------------------------------------------------+
| Welcome to Tsinghua Open Source Mirror Site. |
| |
| This mirror is also available on HTTP. |
| HTTP [https://mirrors.tuna.tsinghua.edu.cn] |
| RSYNC [rsync://mirrors.tuna.tsinghua.edu.cn] |
| |
| If you have any issues, please contact us |
| via GitHub @ https://github.com/tuna/issues |
| or IRC at #tuna on freenode |
| or Fishroom at https://fishroom.tuna.moe/ |
| |
| Supported by |
| Tsinghua Information Technology Center |
| Maintained by |
| Tsinghua University TUNA Association |
| Service Provided by |
| nanomirrors |
| |
+==================================================+
Note: This service is provided with a modified
version of rsync. For detailed information, please
visit: https://github.com/tuna/rsync
receiving file list ... done
PortIndex
sent 38 bytes received 1938670 bytes 298262.77 bytes/sec
total size is 14308917 speedup is 7.38
+==================================================+
| Tsinghua University |
| -= Open Source Mirror Site =- |
+--------------------------------------------------+
| Welcome to Tsinghua Open Source Mirror Site. |
| |
| This mirror is also available on HTTP. |
| HTTP [https://mirrors.tuna.tsinghua.edu.cn] |
| RSYNC [rsync://mirrors.tuna.tsinghua.edu.cn] |
| |
| If you have any issues, please contact us |
| via GitHub @ https://github.com/tuna/issues |
| or IRC at #tuna on freenode |
| or Fishroom at https://fishroom.tuna.moe/ |
| |
| Supported by |
| Tsinghua Information Technology Center |
| Maintained by |
| Tsinghua University TUNA Association |
| Service Provided by |
| nanomirrors |
| |
+==================================================+
Note: This service is provided with a modified
version of rsync. For detailed information, please
visit: https://github.com/tuna/rsync
receiving file list ... done
PortIndex.rmd160
sent 38 bytes received 622 bytes 440.00 bytes/sec
total size is 512 speedup is 0.78
---> 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.基础命令
# 更新ports tree和MacPorts版本,-v参数显示详细信息,与很多其他命令一样功能。
sudo port -v selfupdate
# 查看Mac Port中当前可用的软件包及其版本
port list
# 搜索索引中的软件
port search name
# 查看包详细信息
port info name
# 查看包详细信赖信息`
port deps name
# 查看安装时允许客户定制的参数
port variants name
# 安装新软件
sudo port install name
# 安装完毕之后,清除安装时产生的临时文件
sudo port clean --all name
# 卸载软件
sudo port uninstall name
# 查看有更新的软件以及版本
port outdated
# 升级可以更新的软件
sudo port upgrade outdated
你也可以通过查看手册详细了解。
man port