Getting Started with Mac Ports
August 23, 2016
Some time ago, after having read about the advantages and disadvantages between Mac Ports and Homebrew I decided in favor of the former. I can't actually recall why exactly. It probably had also a little to do with my plans of running FreeBSD 11 on a fanless computer I bought ages ago.
I bought a Mac Mini back in December 2014; my first Apple computer. Before I was running Ubuntu Linux on a Dell Vostro 200ST, so it was easier to buy Parallels and run my work environment inside a virtual machine instead of immediately switching to OS X.
But over time I have become more and more dissatisfied with Parallels. For example, earlier this year a working installation of Ubuntu 15.10 suddenly broke because of a Compiz update. While I managed to find a workaround, blocking Compiz from updating in a fresh install of Ubuntu 15.10, it took Parallels weeks and weeks to come up with an update including a fix for this issue. And this was not the first issue I had with Parallels, so I started to consider to buy either another computer to run Ubuntu on bare metal or finally switch to OS X for my work. And of course I picked the latter, why else buy an Apple computer.
So, today I made the first step of the migration: installing Mac Ports so I can run on OS X some of the software I am used to run under Ubuntu or because I want to use a more recent version compared to what comes with OS X "El Capitan", e.g. git
. For some other programs I want to give Docker for Mac a spin. But first, Mac Ports.
Prerequisites: Xcode and Xcode Command Line Tools
The Mac Ports site lists Xcode and the Xcode command line tools as prerequisites. As I had already installed Xcode some time ago I just checked if there was an update in the App store; but none was listed.
Next, I ran xcode-select --install
in a terminal and clicked the Install
button in order to install the command line developer tools. I agreed
with the license shown and the download process started. For one reason
or another the download was slow, it took well over 15 minutes.
Finally, I ran sudo xcodebuild -license
which showed the start of the Xcode license. After pressing space several times I reached the end and could agree with the license by typing agree
.
Installing MacPorts (El Capitan)
Since I am running El Capitan I downloaded MacPorts for OS X 10.11 El Capitan via the Installing Mac Ports Quickstart section. After a very short time I ended up with a 3.2 MB file named MacPorts-2.3.4-10.11-ElCapitan.pkg
. I double clicked the file to start the installation and clicked on the Continue button. A Read Me was shown and I clicked the Continue button again. A license was shown and again I clicked the Continue button. A dialogue windows popped up and I clicked the Agree button to agree with the license. I clicked the Install button, entered my password, and after about 10 minutes Mac Ports was finally installed on my Mac Mini.
Updating Ports
The Mac Ports page recommends to manually run sudo port -v selfupdate
on a regular basis. Even though the installer had already run this command for me,
I decided to run it in a new terminal tab (so the port
command can be found) anway. Unexpectedly, the ports tree got updated:
... lines omitted for clarity ...
Creating port index in /opt/local/var/macports/sources/rsync.macports.org/releas
e/tarballs/ports
Adding port python/py-fabio
Adding subport py27-fabio
Adding subport py34-fabio
Adding subport py35-fabio
Total number of ports parsed: 4
Ports successfully parsed: 4
Ports failed: 0
Up-to-date ports skipped: 21250
---> MacPorts base is already the latest version
The ports tree has been updated. To upgrade your installed ports, you should run
port upgrade outdated
So I ran sudo port upgrade outdated
which reported:
No ports are installed.
Not really a surprise; I had not installed anything yet.
Next I installed git
using Mac Ports because I wanted the latest version, 2.9.3 at the time of writing, and considered this a good exercise to familiarize myself with Mac Ports.