1. Introduction
2. Installing MacPorts
2.1. Install X11
2.2. Install Xcode Tools
2.3. Install MacPorts
2.4. MacPorts Upgrade
2.5. Uninstall
2.6. MacPorts and the Shell
3. Using MacPorts
3.1. The port Command
3.2. Port Variants
3.3. Common Tasks
3.4. Port Binaries
4. Portfile Development
4.1. Portfile Introduction
4.2. Creating a Portfile
4.3. Example Portfiles
4.4. Port Variants
4.5. Patch Files
4.6. Local Portfile Repositories
4.7. Portfile Best Practices
5. Portfile Reference
5.1. Global Keywords
5.2. Global Variables
5.3. Port Phases
5.4. Dependencies
5.5. Variants
5.6. Tcl Extensions
5.7. StartupItems
5.8. Livecheck / Distcheck
5.9. PortGroups
6. MacPorts Internals
6.1. File Hierarchy
6.2. Configuration Files
6.3. Port Images
6.4. APIs and Libs
6.5. The MacPorts Registry
7. MacPorts Project
7.1. Using Trac for tickets
7.2. Contributing to MacPorts
7.3. Port Update Policies
7.4. MacPorts Membership
7.5. The PortMgr Team
8. MacPorts Guide Terms
Glossary
Single Page Chunked

Global variables are variables available to any Portfile. For a list of additional variables available to ports that are assigned to a MacPorts Portgroup, see portgroup(7).

All of these variables except prefix are read-only!

prefix

Installation prefix, set at compile time and displayed in ${prefix}/etc/macports/macports.conf —- may be overridden on a per-port basis, for example to install into a wholly-contained subdirectory of ${prefix}, but most ports should have no reason to do so.

Default: /opt/local

libpath

Path to the MacPorts TCL libraries.

binpath

The directory search path for locating system executables (rsync, tar, etc.) during port installation. Only applications in these directories are available while ports are being installed even if other paths are specified by $PATH in a user's environment.

Default: ${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin

Note

The binpath is implicitly defined, but it may be overwritten by defining the variable in macports.conf. However, using a non-default binpath is discouraged and should only be performed by advanced users.

portpath

Full path to the Portfile of the port being executed. Portfile repositories are defined in the file sources.conf.

Default: ${prefix}/var/macports/sources/rsync.macports.org/release/ports/<category>/<portname>/

filesdir

Path to files directory relative to ${portpath}.

Value: files

filespath

Full path to files directory.

Value: ${portpath}/${filesdir}

workpath

Full path to work directory.

Value: ${portbuildpath}/work

worksrcpath

Full path to extracted source code.

Value: ${workpath}/${worksrcdir}

destroot

Full path into which software will be destrooted.

Value: ${workpath}/destroot

distpath

Location to store downloaded distfiles.

Value: ${sysportpath}/distfiles/${dist_subdir}/

install.user

The Unix user at the time of port installation.

install.group

The Unix group at the time of port installation.

os.platform

The underlying operating system platform (i.e. "darwin" on Mac OS X, "freebsd", etc.).

os.arch

The hardware architecture -- either "powerpc" or "i386".

os.version

The version number of the host operating system (i.e. "8.11.0" for Darwin 8.11.0 a.k.a. Mac OS X 10.4.11).

os.endian

Endianness of the processor -- either "big" (on PowerPC systems) or "little" (on Intel systems).

os.major

The major version number of the host operating system (i.e. "8" for Darwin 8.x).