While the Mac OS X provides us easy access to the much-beloved terminal, by itself, it is very limited. Apple does not support or maintain its Terminal or X11/XQuartz applications; it is rather supported by an independent group of developers (see XQuartz wiki). However, as the Mac OS X is built on X11, there is no need to install a complete UNIX OS, it does require quite a bit of work to make your machine Unix-capable. For long, the open-source project Fink has long been our savior. Over the past few years, MacPorts has developed as a very nice alternative to Fink in the last couple years. While both systems serve the same purpose, there are differences that make one or the other more appealing. For e.g., if you only need a handful of applications (and not the entire Red Hat system), MacPorts is much easier and faster to install. It takes a couple minutes, which is miniscule compared to the ~45 mins needed for Fink. The caveat being that while Fink installs most of the basic tools and libraries that will be needed in the future and ‘completely’ builds the Unix environment, MacPorts only creates the basic directory structure during installation. For this reason MacPorts uses less hard disk space as well. Of course, you can build ports from fink in MacPorts and vice versa — it just takes a little more effort. In my experience it also takes 3-4 attempts before you get Fink installation right.
The other (big) advantage of Macports is its more active developer base; hence, the various packages tend to get updated quicker. While it is not necessary to keep your packages updated by the day (or the month), it is always nice not to have to wait months for a fix. The good news is that the Macports port library is becoming as extensive as the fink library despite its late start. Again, if you have the expertise, you can always install fink packages in your Macports system as both are open source.
Pre-requisites: Assuming you have a Mac OS X, get the latest versions of X11 and XCode. That is basically it! Then go to the MacPorts install page, download the dmg, and start building any (or all) of its 7015 ports (in 92 different categories). And have fun!
Basic Commands: The average Macports user needs only a handful of commands to install, upgrade, and remove MacPorts. The MacPorts Guide talks about all of these commands (and more) in more detail. But this should be all you need if you are a basic user. You will need ‘sudo’ for most of these commands, i.e., when write/execute permissions are needed. I have used ’emacs’ as an example for package name.
update macports: port selfupdate list all available (installed/outdated) ports: port list (installed/outdated) search available ports: port search emacs install ports: port install emacs upgrade all (one) outdated ports: port upgrade outdated (emacs) uninstall (deactivate) ports: port uninstall (deactivate) emacs uninstall MacPorts: rm -rf /opt/local/ /Applications/MacPorts/ /Library/Tcl/macports1.0/ /Library/LaunchDaemns/org.macports.*
MacPorts PATH: Ports downloaded via MacPorts will be in ‘/opt/local/bin/’, separate from ports native to X11 (e.g. ls, cd, more, gzip, …) that are stored in ‘/usr/bin/’; MacPorts will automatically add this to your PATH on installation. Of course, if you download a port that already exists in ‘/usr/bin’, it will supersede the older one. No harm done, except for the few kilobytes in hard disk space.
Starting List of ports/apps: While the ports or apps you should download depends on your need, for the normal astronomer, I would recommend the following ports: aspell/ispell, teTeX, auctex, emacs/xemacs, gcc, ghostscript, ghostview, gsed, wget, rsync, tightvnc, perl, python, ruby, R, and gimp; see here for more info on these ports. When you install these ports, a lot more ports and libraries will be installed as dependencies, especially gimp will install a lot of ports. Of course, you should browse through the available ports page. Note that installing these ports will take a while (especially gimp) and might test your patience as each application is built from its source code.
Cleaning old ports/apps: MacPorts tends to NOT uninstall old versions of downloaded ports. This means you are wasting a few GBs of your hard drive; I had 6 GB the first time I cleaned up my MacPorts hierarchy. Run the following to do a clean :
sudo port clean --all installed sudo port -f uninstall inactive
If you want to see how much you saved, use ‘du -sh /opt’.
Some GUI applications like the Chicken of the VNC, TeXShop, LaTeXiT, and Adium are also available via Macports. Whether you download the GUI by itself or as a port (will be installed in ‘/Applications/Macports/’), the functioning will be the same.