Sunday the 14th of September, 2008
How to Install DarwinPorts
1. Install Xcode Tools
Notes: Xcode Tools is neither installed nor updated via the Software Update utility.
2. Install XWindows (X11)
On OS X 10.4, Apple's X11 is an optional install (DarwinPorts' X11 package is not recommended at this time). If the application X11 is not present in /Applications/Utilities:
3. Set the shell environment
Setting the Unix shell environment is critical for DarwinPorts to function.
Requirements for the DarwinPorts' shell environment
The DarwinPorts binary installer places a .profile file in your home directory (view files preceded by a dot with 'ls -a'). The contents of this ~/.profile file adds the DarwinPorts paths in front of the standard Unix paths for the default BASH shell. This is done so that if you have utilities or libraries from both DarwinPorts and OS X's standard install, the DarwinPorts libraries will be run instead of the ones provided by Apple.
You'll need to add this variable to your ~/.profile to run X11 applications:
So a basic ~/.profile file will look like this:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH export DISPLAY=:0.0
Verify the shell environment
To verify that your ~/.profile has set your shell environment:
Check to make sure the reported path begins with the DarwinPorts' paths as show above.
Sample output of command env:
TERM_PROGRAM=Apple_Terminal TERM=xterm-color SHELL=/bin/bash TERM_PROGRAM_VERSION=133 USER=mduling __CF_USER_TEXT_ENCODING=0x1F6:0:0 PATH=/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
Options for the DarwinPorts' shell and X11 environment
To set a default editor for use with the port command (e. g. 'port ed mysql5'), add a variable EDITOR with the path of your favorite editor to the ~/.profile file.
A sample ~/.profile with optional EDITOR variable set:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH export DISPLAY=:0.0 export EDITOR=/usr/bin/pico
To launch X11 apps directly from an X11 window (instead of a terminal window), you need to have the DarwinPorts paths imported into X11 sessions when they are opened. This is a two step process.
First, tell X11 about your .profile file by editing the file /etc/X11/xinit/xinitrc and add this line near the top.
Now finish by making any subsequent X11 sessions opened using the menubar respect your .profile.
4. Install DarwinPorts
Install DarwinPorts using the binary installer (to /opt/local/ only)
Install DarwinPorts from source (to any path except /usr/local/)
Install DarwinPorts that you downloaded
5. Update DarwinPorts via selfupdate
The 'port selfupdate' command must be run after a new DarwinPorts install, and frequently thereafter. The command updates DarwinPorts with the latest port revisions, and, if necessary, updates DarwinPorts to the latest release.
sudo port selfupdate
or for verbose output:
sudo port -d selfupdate