Moving from Macports to Homebrew

I have been using Apple laptops for a very long time. My first laptop was a Titanium PowerBook G4 (TiBook) that I bought in 2002. I had initially got a SONY laptop and installed Debian on it — so technically, that was the first! But then a friend advised me that I should get an Apple instead as the OS X (I think it was 10.2 Jaguar) is based on BSD Unix — which is not too different from Linux. So I returned the SONY (it was within 30 days) and got the TiBook. I immediately partitioned the hard drive and installed Debian in one and OS X in the second partition. It was a pain to switch between the two partitions and difficult to move contents between the two. That’s when I discovered Fink. [1]https://www.finkproject.org So, I again reformated the partition, removed Debian, and made a custom installation of only OS X (and again and again later!).

When I bought my Macbook Pro in 2009, I abandoned Fink and moved to Macports, [2]https://www.macports.org along with compiling some directly outside the Macports system. Over the years, my dependence on Macports has gone down. Nevertheless, since Macports installs all the dependencies (instead of using from the macOS), it occupies a large amount of space (about 4GB) in the hard disk. While 4GB may not be considered substantial in today’s world, since I use very few packages from Macports, it seems large! That’s why I decided to try out the Homebrew, [3]https://brew.sh which seems to utilize the existing macOS libraries.

Unstalling Macport

[‘$’ denotes executing a command from a terminal]

$ sudo port -fp uninstall installed
$ sudo rm -rf \
    /opt/local \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0 \
    ~/.macports

Finally, remove (or comment with #) the Macports paths from .bashrc

#PATH=/opt/local/bin:/opt/local/sbin:$PATH
#MANPATH=/opt/local/share/man:$MANPATH

Installing Homebrew

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

If I want to uninstall homebrew in future:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

or download the uninstall script and run 

$ /bin/bash uninstall.sh

Example of Installing packages

#[wget]
$ brew install wget

#[gnuplot]
$ brew install gnuplot

#[aspell]
$ brew install aspell

#[djview]
$ brew cask install djview