Automatic download, build, and install

A long time ago, on a planet far away, some people figured out that a lot of redundant effort was being wasted building and installing the same programs on the same computer systems. They thought to themselves, "Hey, wouldn't it be nice if the first guy who did this automated it, so that the rest of us wouldn't have to jump through all the same hoops?" And so, ports were born.

A port is a framework for automatically downloading, building, and installing a software package, along with all the other software that it depends on. Ports save the end user from having to track down the source code or binary distribution files, plus all the prerequisite libraries and installation tools needed to build and install a program. In many cases, specific versions of libraries are required, and it's not always clear which ones will work.

Ports also save the user from having to figure out the tweaks necessary to make the software build on their particular operating system. Instead, the port maintainer figures all of this out once so that nobody else will have to again (at least until the next version of the software is ported.)

The affects of a ports system on your productivity can be enormous. For complex software, a port can reduce many hours or days of work to one simple command.

Creating a port can take a lot of effort, but it's basically a process of meticulously documenting the steps needed to install the program manually. By creating a port, the porter saves all those who use the port from going through the same trouble.

For example, to manually build and install AFNI would require the following steps:

  1. Install the correct version of the OpenGL libraries (e.g. Mesa)
  2. Install the correct version of the gettext library
  3. Install GNU make (if it isn't the native make on your OS)
  4. Install the the correct version of the iconv library
  5. Install the the correct version of the Motif libraries
  6. Install AFNI
Each of these steps requires finding the software on the WEB, downloading it, and following the (often esoteric) instructions to build it on your system. The instructions could be completely different for each piece of software, and may not be tested on your particular OS, in which case you'll have to figure out how to tweak them. Each step may also require additional prerequisite steps. ( e.g. installing gmake requires gettext and other libraries that might not be on your system yet. )

Going through this process just once can turn into a daunting project. Moreover, this practice is not scalable, i.e. there are limits on the number of computers you can manage this way. If you need to set up many workstations, you'll need a much more efficient way to manage the software.

In contrast to the manual steps above, to install AFNI using the FreeBSD ports system, simply run the following commands as root:

    cd /usr/ports/science/afni
    nice make install
    

That's it. The ports system will automatically download, build, and install AFNI, along with the correct versions of Motif, iconv, GNU make, and everything else AFNI depends on.

To install from MacPorts, run the following as root:

    nice port install afni
    

For large programs with many prerequisites, this process may still take a while, but you don't have to do anything but type the install command. The ports system knows everything necessary to install the software for you.

Note: Logging in as root is unsafe. It's too easy for the root user to damage a system through a careless typo or by inadvertently running malicious software. Users should use sudo to run individual commands with root privileges instead.