## 6.3. GNU-Darwin

The FreeBSD ports and package management system is used by the GNU-Darwin distribution (http://gnu-darwin.sourceforge.net).

The ports system provides for packaging an application as a single file that contains precompiled binaries, as well as associated configuration and documentation files. Like dpkg, this system allows the installation of a software package with a single command. This system also maintains an installed package database and understands dependencies. Additionally, to support installing remote packages, a remote ports tree is established. The ports tree resides on your computer and includes makefiles that know how to find, patch, compile, package, and install software packages from source code. Current versions of ported software are stored in one or more ports trees.

> WARNING: Unlike Fink, GNU-Darwin does not restrict itself to one portion of your filesystem, and it will make changes to system binaries. We suggest that you read the one_stop script carefully before you execute it.

To install GNU-Darwin, perform the following steps:

1. Download the one_stop script from http://gnu-darwin.sourceforge.net/one_stop.

2. Read the one_stop script so you know what it's going to do.

3. Execute the one_stop script as root (sudo csh one_stop).

The one_stop installer downloads and installs many packages, so give it some time to complete.

> WARNING: The one_stop installer requires a considerable amount of bandwidth and does not allow you to choose a subset of packages, so it should not be attempted on a low-bandwidth connection. Again, read the script before you run it. As of this writing, the script states that GNU-Darwin will take up one gigabyte of disk space when one_stop finishes.

After you install GNU-Darwin, you can install additional software by downloading precompiled tarballs and using the package management commands listed in Table 6-3. Alternatively, you can install the GNU-Darwin ports system from http://gnu-darwin.sourceforge.net/ports/ and then:

1. cd to /usr/ports.

2. Find the subdirectory of the port you want to install and cd into it.

3. Run the command sudo make install, which performs the following:

   1. Downloads the source code for the package.

   2. Downloads and applies any relevant patches.

   3. Compiles and installs the package.

   4. Repeats those steps for any dependencies.

After you install the package with make install, you can manage it with the package management tools shown in Table 6-3.

#### Table 6-3. Using the FreeBSD package management system

Command | Description
--- | ---
`pkg_add` `package.tgz` | Adds (installs) a `package`.
`pkg_add -r` `package.tgz` | Adds a remote `package`. Checks a predetermined ports tree location.
`pkg_delete` `package` | Deletes (uninstalls) a `package`.
`pkg_info` | Shows information on installed `packages`.
`pkg_info` `package` | Shows information on an installed `package`.
`pkg_info -L` `package` | Shows files belonging to a `package`.
`pkg_version` | Compares versions of installed `packages` with current versions in ports tree.

Copyright © 2003 O'Reilly & Associates. All rights reserved.