If you are using Mac OS X, you should install MacPorts using the Mac
OS X package installer unless you do not wish to install it to
/opt/local/, the default MacPorts location, or if you
wish to install a pre-release version of MacPorts base. However, if you
wish to install
multiple copies of MacPorts or install MacPorts on another OS
platform, you must install
MacPorts from the source code.
Though a distinction is made between pre-release and release versions of MacPorts base, the ports collection supports no such distinction or versioning. The selfupdate command installs the latest port revisions from subversion (at a slight delay), and updates MacPorts base to the latest released version.
The Mac OS X package installer automatically installs MacPorts, sets the shell environment, and runs a selfupdate operation to update the ports tree and MacPorts base with the latest release.
Download the latest MacPorts-1.x.x.dmg
disk image (whose name does not contain -beta or -rc) from the MacPorts
download directory.
Double-click the MacPorts-1.x.x.pkg
package installer on the disk image.
Perform the default “easy” install.
If you installed MacPorts using the package installer, skip this section. To install MacPorts from the source code, follow the steps below.
Download and unzip the latest MacPorts tarball from the MacPorts download directory.
Perform the commands shown in a terminal window. If you wish
to use a path other than /opt/local, use the
option --prefix and substitute a path for
NEW_PREFIX.
%%cd ~/MacPorts-1.x.x/%%./configure--prefix=NEW_PREFIX (setting prefix is optional)%%make%%sudo make install
If you installed MacPorts using the package installer, skip this section.
There are times when some may want to run MacPorts from a version newer than the current stable release. Maybe there's a new feature that you'd like to use, or it fixes an issue you've encountered, or you just like to be on the cutting edge. These steps explain how to run completely from trunk, using only Subversion to keep MacPorts up to date.
Check out MacPorts source
Pick a location to store a working copy of the MacPorts code.
For this example, /opt/mports will be used, but
you can put the source anywhere. This example will create
/opt/mports/trunk containing everything needed
for MacPorts.
%%mkdir -p /opt/mports%%cd /opt/mports%%svn checkout http://svn.macports.org/repository/macports/trunk
/base
to the end of the svn checkout command above. The resulting directory will then be
/opt/mports/baseBuild and Install MacPorts
MacPorts uses autoconf and makefiles for installation. These
commands will build and install MacPorts to
/opt/local. You can add the
--prefix option to ./configure
to relocate MacPorts to another directory if needed.
%%cd /opt/mports/trunk/base%%./configure --enable-readline%%make%%sudo make install%%make distclean
(Optional) Configure MacPorts to use port information from Subversion
This step is useful if you want to do port development. Open
/opt/local/etc/macports/sources.conf in a text
editor. The last line which should look like this:
rsync://rsync.macports.org/release/ports/
Change it to point to the working copy you checked out:
file:///opt/mports/trunk/dports
Now MacPorts will look for portfiles in the working copy.
Environment
You should setup your PATH and other environment options according to the following section.
Occasionally a MacPorts developer may wish to install more than
one MacPorts instance on the same host. Only one copy of MacPorts may
use the default Tcl library path /Library/Tcl/, so
for additional installations use the option
--with-tclpackage as shown below. It's also recommended
to change the applications dir using
--with-applications-dir to avoid conflicts in
/Applications/MacPorts.
The first command temporarily removes the standard MacPorts binary paths because they must not be present while installing a second instance.
%%export PATH=/bin:/sbin:/usr/bin:/usr/sbin%%MP_PREFIX=/opt/macports-test%%./configure --prefix=$MP_PREFIX --with-tclpackage=$MP_PREFIX/Library/Tcl --with-applications-dir=$MP_PREFIX/Applications%%make%%sudo make install