MacOS – Macports: How to install ports using only versions from a date in the past

macosmacportsterminal

Two years ago, I used Macports to install a copy of Docker Machine onto a computer running OS X 10.9 "Mavericks". All I had to do was type sudo port install Docker-machine, and Macports automatically pulled down and compiled everything I needed.

As of August 2020, this doesn't work on Mavericks due to a bug in the latest versions of Go and/or Macports's Legacy Support framework. Since Mavericks is very old, this breakage is understandable. However, Docker Machine did work as of two years ago, and I wouldn't mind using an older version.

Using a clean Macports prefix, how can I install ports using only software that existed as of a certain date in the past? I do not want to merely install an older version of Docker Machine; I want to install an older version of Docker Machine and every port that Docker Machine depends on, such as Go and Legacy Support.

On Debian, this would be super easy; I'd just edit sources.list to point to a snapshot. How can I do something similar in Macports? The full Macports project history is tracked in Git, so I'm pretty sure it's possible.


† I'm delighted that Macports supports Mavericks at all. With Homebrew I would be completely SOL.

‡ Because I tried that, and it doesn't work. Which isn't particularly surprising given how ports and their dependencies are interconnected. For reference, the procedure for installing an older version of a single package is documented here.

Best Answer

Thank you to Lothar Haeger on the Macports mailing list for giving me the key hint I needed. What I had to do was:

  1. Checkout a local copy of the Macports Port Tree from Github. cd ~; git clone https://github.com/macports/macports-ports

  2. Reset my local port tree to an earlier point in time. cd macports-ports; git reset --hard commit-hash-from-2018

  3. Generate a port index for my local port tree: portindex

  4. Tell Macports to use my local port tree in place of the official online one. To do this, I opened macports's sources.conf (generally in /opt/local/etc/macports/) in a text editor, commented out the default URL at the bottom of the file, and added after it: file:///Users/my-user-name/macports-ports [default]