installing an older version of a port in the github era -- an answer

Ken Cunningham ken.cunningham.webuse at
Mon Dec 26 20:27:36 CET 2016

So, this turns out to be a lot easier than I originally thought it
would be, and probably is no more difficult than svn was. This may not
be the most efficient way of doing it, but it's fairly easy to
understand, and it works for me.

Here are (perhaps too many) steps regarding how to do it.

Start with a local macports repository cloned from the original. To do
this, I created a macports-ports fork using the web gui, into my local
git account. Then created a local repository on disk by cloning that
into /opt/macports-ports.

cd /opt
sudo git clone

That gives you the full history of macports-ports back in time. Then use

port info PORT

to find the path to your port,  eg in this example case devel/libuv

now examine the commit history of that path to see where you want to
go back in time to:
sudo git log -p pathto/port


sudo git log -p devel/libuv

you will see all the commits that touched this path. Keep scrolling
until you find what you want, for example this commit looks like what
I'm after here, which bumped the release to 1.9.1 -- so we'll go for
that version:

commit 5f3cbc9c2d9c6c8cb84e708a4ae6057ccc244608
Author: Michael Dickens <michaelld at>
Date:   Thu Sep 1 12:08:28 2016 +0000

    + add me as comaintainer, but still openmaintainer;
    + move to using github portgroup;
    + bump release to 1.9.1;


Copy that commit hash.

now quit git log, and then make a new branch with that commit as the
marker in time, for example:

sudo git checkout -b libuv-191 5f3cbc9c2d9c6c8cb84e708a4ae6057ccc244608

you will automatically be on the new branch now. Go to the folder
you're interested in and take a look:

cd ./devel/libuv
cat Portfile

 -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil;
c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$

PortSystem          1.0
PortGroup           github 1.0

name                libuv
categories          devel
platforms           darwin
maintainers         raimue michaelld openmaintainer
license             {MIT BSD}

description         Cross-platform asychronous I/O

long_description \
    libuv is a multi-platform support library with a focus on asynchronous I/O.

# common directory for storing downloaded tarballs
dist_subdir         libuv

if {${subport} eq ${name}} {

    github.setup    libuv libuv 1.9.1 v


yep - that's it. if there were any files in the files directory, you'd
have those at that point in time too.

move out of the port directory, and copy those into a local repo (like
this one /opt/peggedports that I use for this):

cd ..
sudo cp -R ./libuv /opt/peggedports/devel/libuv

move back up to the top level
cd ..
switch to the master branch

sudo git checkout master

list your branches

sudo git branch --list

and delete the temporary back-in-time branch you no longer need, in this case

sudo git branch -D libuv-191

and you're done.

Hope this helps someone.


More information about the macports-dev mailing list