Macports

Macports provides hundreds of Open Source Unix tools compiled for OS X, free.

Macports is an alternative to Fink. You can use either or use both and install some packages with one tool and some with the other. I use Macports for everything now.

Installing Macports

If you are upgrading from a previous version, see https://trac.macports.org/wiki/Migration.

Here are instructions for setting up a 64-bit Macports, tested
April 2014 on 10.9.2 Mavericks,
Oct 2015 on 10.10.5 Yosemite,
May 2016 on 10.11.5 El Capitan,
July 2017 on 10.12.6 Sierra .
March 2018 on 10.13.3 High Sierra .

Instructions

Apple provides Perl 5.16 with Mavericks and Yosemite, and 5.18.2 with El Capitan, Sierra, and High Sierra. On recent versions of OS X, installing certain ports will cause Macports to install a later version of Perl (on Sierra, it installed 5.24, and 5.26 for High Sierra). If you then update CPAN, it will install Perl modules into that version's libraries. The version of Perl executed by programs will depend on the shebang line at the top of the file, and that is where library files will be searched for. The result is that modules you just installed will not be found, and attempts to install ports will fail with messages about variants. Fix this by patching the system version of Perl to point to the MacPorts version of Perl before updating CPAN.

High Sierra

When I was transitioning to Migh Sierra, I installed the Apple developer tools using xcode-select --install, and then installed MacPorts. When I tried to install the first ports, I got the message

  Error: the installed version of Xcode (7.3.1) is too old to use on the installed OS version.

.. so I had to install the full Xcode. This took about an hour. Then I tried to install ImageMagick. This failed with a message that a .gz file (part of Ghostscript) was an HTML error message that said I was trying to download from SourceForge.net and it was "in Disaster Recovery Mode." I was stuck for several days.

For High Sierra, installing ImageMagick installed Perl 5.26. I used PERL5LIB=/Users/myname/bin:/opt/local/lib/perl5/site_perl/5.26 and symlinked /usr/bin/perl to /opt/local/bin/perl to ensure that the correct version of Perl is invoked (had to temporarily disable SIP). See the CPAN instructions for how to do this. I also did

    export PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.24
    export PERL_LOCAL_LIB_ROOT="/opt/local/lib/perl5/5.24"
    export PERL_MB_OPT="--install_base "/opt/local/lib/perl5/5.24""
    export PERL_MM_OPT="INSTALL_BASE=/opt/local/lib/perl5/5.24"

Sierra

For Sierra, I used PERL5LIB=/Users/myname/bin:/opt/local/lib/perl5/site_perl/5.24 and symlinked /usr/bin/perl to /opt/local/bin/perl to ensure that the correct version is invoked (had to temporarily disable SIP). See the CPAN instructions for how to fix this. I also did

    export PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.24
    export PERL_LOCAL_LIB_ROOT="/opt/local/lib/perl5/5.24"
    export PERL_MB_OPT="--install_base "/opt/local/lib/perl5/5.24""
    export PERL_MM_OPT="INSTALL_BASE=/opt/local/lib/perl5/5.24"

Problem with Poppler

On Sierra, I tried to install poppler in order to get pdftotext. It dragged in a whole pile of dependencies and then the install failed with the message

      unable to configure poppler.

I Googled this problem and was led to uninstall poppler, install boost@1.63.0 and readline@6, and reinstall poppler. That worked. I have not tried this yet with High Sierra.

El Capitan

For El Capitan, I used PERL5LIB=/Users/myname/bin:/opt/local/lib/perl5/site_perl/5.22 and linked /usr/bin/perl to /opt/local/bin/perl to ensure that the correct version is invoked (had to temporarily disable SIP). I also did

    export PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.22
    export PERL_LOCAL_LIB_ROOT="/opt/local/lib/perl5/5.22"
    export PERL_MB_OPT="--install_base "/opt/local/lib/perl5/5.22""
    export PERL_MM_OPT="INSTALL_BASE=/opt/local/lib/perl5/5.22"

Home | FAQ © 2010-2018, Tom Van Vleck updated 2018-10-26 09:31