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.
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,
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.
January 2019 on 10.14.2 Mojave.
Don't install tidy from macports.. use https://github.com/htacg/tidy-html5 instead.
(Apple has announced that in versions of macOS after Catalina, they will not provide Python, Perl, or Ruby. This is a small loss since the versions they had been shipping with the OS were usually downrev. For Catalina, I will install a later version of Perl, as a side effect of the various ports I install. Apple provides Perl 5.16 with Mavericks and Yosemite, and 5.18.2 with El Capitan, Sierra, High Sierra, and Mojave.)
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 and Mojave). 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 risk is that modules you just installed will not be found, and attempts to install ports will fail with messages about variants. Fix this by making /usr/local/bin/perl a symlink to the MacPorts version of Perl in /opt/local/bin/perl before updating CPAN, and making sure that all library Perl programs and modules use #!/usr/local/bin/perl as their "shebang" line. (The reason for this complexity is that you can't change /usr/bin due to System Integrity Protection.)
For Mojave, I installed the full Xcode and the command line extensions, and then installed MacPorts. Installing ImageMagick installed Perl 5.28.
When I was transitioning to High 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. Then they fixed their error.
For High Sierra, installing ImageMagick installed Perl 5.26. I set my startup environment to
export PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.26 export PERL_LOCAL_LIB_ROOT="/opt/local/lib/perl5/5.26" export PERL_MB_OPT="--install_base "/opt/local/lib/perl5/5.26"" export PERL_MM_OPT="INSTALL_BASE=/opt/local/lib/perl5/5.26"
For Sierra, I used PERL5LIB=/Users/myname/bin:/opt/local/lib/perl5/site_perl/5.24 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"
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 firstname.lastname@example.org and readline@6, and reinstall poppler. That worked. I have not tried this yet with High Sierra.
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 set up my bash configuration to do
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"