header

Torsten Curdt’s weblog

More recent Macports

I have never been a big fan of manually compiling and installing packages – especially on OSX. It just can’t be a good thing to scatter files around like that. This is probably just one of the reasons why thousands of other Mac users also chose to use fink or macports to install custom packages. Coming from the debian world I started out with fink and it’s apt-get install. Later I’ve switched to macports because it seem to provide more recent packages. Unfortunately sometimes even macports is a little outdated. But with a few commands you might be able to install a new port anyway.

Let’s demonstrate this on the exiv2 package. First check the versions.

$ port livecheck exiv2
exiv2 seems to have been updated (port version: 0.14, new version: 0.18-pre1)
$ port search exiv2
exiv2      graphics/exiv2 0.14   EXIF and IPTC metadata manipulation...

In this case the macport only provides version 0.14 but a much newer version was released. While macports is an open source project and always looking for contributors you can’t just update the port in the official repository – but you can create a local one. Just add a directory as your local repository.

$ cd /opt/local/etc/macports/
$ vi sources.conf

The file should now look something like this

rsync://rsync.macports.org/release/ports/ [default]
file:///Users/tcurdt/ports

Then search and copy/download the original ports file for the latest version.

$ locate Portfile | grep exiv2
/opt/local/var/macports/sources/rsync.macports.org/release/ports/graphics/exiv2/Portfile

This needs to go into your local repository. With the same directory structure.

$ mkdir -p ~/ports/graphics/exiv2
$ cp /opt/local/var/macports/sources/rsync.macports.org/release/ports/graphics/exiv2/Portfile ~/ports/graphics/exiv2/Portfile
$ vi ~/ports/graphics/exiv2/Portfile

Update the portfile to the latest version and then update the port index so your local version gets included.

$ sudo portindex
Creating software index in /Users/tcurdt/ports
Adding port graphics/exiv2

Total number of ports parsed:  1
Ports successfully parsed:  1
Ports failed:  0

When you now do a search you should see both versions available.

$ port search exiv2
exiv2     graphics/exiv2 0.14     EXIF and IPTC metadata manipulation...
exiv2     graphics/exiv2 0.17.1   EXIF and IPTC metadata manipulation...

Now you can just try to install and activate it as usual. Good luck with your new ports! And don’t forget to contribute the updated portsfile back to the macports project.

  • Wouter
    A bit of an old post ... but I updated to exiv2 v0.20 and just changing the version and the md5 sum in compiled successfully.
    However there seems to be a bug for the Olympus raw file writing support so I suggest not to incorporate it into macports just yet.
  • Cool! I always wondered how to do this, but never got around to figuring it out myself. Thanks!
blog comments powered by Disqus