Last updated on October 1, 2016
Homebrew and Macports are two excellent package managers on OS X. At most of the time, Homebrew is fair enough: it has a large package collections. But sometimes, there are just some packages not available in Homebrew while they are in Macports. Although having both of them installed is not recommended, I still want to give it a try.
The basic rules here are using Homebrew packages as much as possible. When one package is not available in Homebrew, install it from Macports (you will soon see why). We will wrap the executables installed by Macports with suitable Environmental Variables.
Please note that this post only presents a workaround. It is not garanteed to work, and it is possible that it does not work under some certain circumstances.
Last updated on December 13, 2017
If you are moving onto macOS/OS X from GNU/Linux, you would probably find out that the command line tools shipped with OS X are not as powerful and easy to use as the tools in Linux. The reason is that macOS/Mac OS X uses the BSD version command line tools, which are different from the Linux version, while they are both compliant with POSIX standards. But we can easily install the GNU command line tools by using Homebrew in Mac OS X and set them as default.
Note: you need to notice that you may have some compatibility issues with shell scripts written specifically for OS X after you have replaced your OS X commands with the GNU version. Although the very vast majority of shell scripts have no problem, you just need to be aware that when there comes a problem, this may be the spot to check on.