DONG Yuxuan @ Feb 03, 2020
If you install MacPorts by the .pkg file,
you may stuck on “Running Package Scripts”.
If it happens, it’s because of that your network is hard to
connect the server of MacPorts to update.
Nevermind, MacPorts is already installed, just not updated.1
Forcely kill the installer using the
You can run
sudo port selfupdate to update it later.
However, because it’s a network issue, you will still stuck
sudo port selfupdate. Don’t worry, continue reading.
MacPorts synchronizes local ports trees with the remote server using rsync. Some networks and proxies prevent or break the use of rsync or svn via http. For people on these networks, getting an updated port tree can be difficult. The rsync server regularly creates a tarball and stores it on the web server. This document explains how to configure MacPorts to use this tarball to update your local ports tree.2
comment out the rsync entry, and add a new entry as follows:
#rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] https://distfiles.macports.org/ports.tar.gz [default]
The ports trees can be synchronized now but not MacPorts itself.
and find the line
Go to https://trac.macports.org/wiki/Mirrors#MacPortsSource
and pick the server near you, for example I’m in China so I pick
pek.cn.rsync.macports.org, and add to the file:
#rsync_server rsync.macports.org rsync_server pek.cn.rsync.macports.org
Now you can run
sudo port selfupdate.
Install Vim by
sudo port install vim +huge.
+huge variant provides many important features
like supporting the system clipboard.
After you have installed Python and
pip with MacPorts.
You may want to install Python packages
that have executable files, Eg.
You can successfully install it.
But when you type
virtualenv from the shell, it can’t be found,
because it’s not placed into
MacPorts provides some Python packages by itself.
For example, you can install
virtualenv for Python 3.6 by running
sudo port install py36-virtualenv.
If MacPorts links executables from
it may conflict with executables from MacPorts.
Personally, I don’t think it’s a good decision.
Firstly, I think Python packages should be provided only by
not by a system package manager like MacPorts.
Secondly, if it really wants to do this,
it should also do this on Ruby packages, Node.js packages, etc.
But it doesn’t.
If you install Ruby packages by
gem, executables will be linked.
My solution is simple.
Supposing MacPorts is installed in the default location
/opt/local and we use Python 3.6,
/usr/local/py3-bin and put it into my
If I want to switch the version of Python, I could just relink it.
After you install Ruby with MacPorts.
You try to install Ruby packages with
For example, you run
sudo gem install jekyll.
But the building may fail for it can’t find some basic header files
You should carefully check the output, it looks like the following:
sysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk doesn't exist
and check files.
MacOSX10.14.sdk or what the file you miss in your system really does
not exist, you could make a symlink to
MacOSX.sdk by yourself.
# under /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ $ ln -s MacOSX.sdk MacOSX10.14.sdk