Installing from Source

Open source Unix software not available as Mac OS X packages exists as bundles of raw (usually C) source code and helper files. Fortunately, there are some long-standing traditions and idioms with Unix source installation that make this process somewhat easier, but there also remain many places to get stuck, which can bewilder those without C-programming experience (and bewilder those with experience if the source is messy enough).

The usual idiom for installing software from source runs as follows.

  1. Obtain the source code as a .tar.gz file (a.k.a. a tarball). If you download it through a web browser, StuffIt Expander automatically inflates it into a folder within your browser’s download folder (see Section 6.2.4); otherwise, manually use StuffIt Expander or (since you’re probably in the Terminal already) the tar command, with its xzvf (tar-extract, gzip-extract, verbose-mode, file-based) options, like so:

    [jmac]% tar xvzf 
                         something-i-just-downloaded.tar.gz
    ...output of list of files and directories extracted...
    [jmac]%
  2. cd into the directory created through the previous step, and read the README and INSTALL files (and generally anything else with an all-caps filename), if they exist. These provide important information, including hints for installing the software on various systems—if Darwin or Mac OS X appear here, you’re in luck. Also consult any information found on the web site for the ftp directory from which you obtained the source. Be generally suspicious ...

Get Mac OS X in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.