Using MacPorts behind a firewall

I failed to persuade [MySQLdb][mysqldb] to build on a [Mac OS X Server 10.5.8][1058] install using the system [Python][python] + [MySQL][mysql] installation. So I turned to [MacPorts][macports] where I know I can get [Django][django] + all the bits working without much hassle (but with much patience).

The next problem was that MacPorts couldn’t update because [rsync][rsync] was blocked by the corporate access policy. Fortunately plain HTTP is permitted outbound. Here’s how to use a local ports tree.

Install MacPorts using the disk image for 10.5.

curl -O
hdiutil attach MacPorts-1.8.2-10.5-Leopard.dmg
sudo installer -pkg /Volumes/MacPorts-1.8.2/MacPorts-1.8.2.pkg -target /
hdiutil detach /Volumes/MacPorts-1.8.2

If the MacPorts install directories are not in your $PATH environment, you can add them to your `.profile`. This change will not take effect until you start a new terminal session.

*(Updated to keep variables as-is as suggested by commenter Bruce).*

cat >> ~/.profile <<\EOF PATH=/opt/local/bin:/opt/local/sbin:${PATH} MANPATH=/opt/local/share/man:${MANPATH} EOF After you have installed MacPorts, create a directory for the ports tree and check it out using [Subversion][svn]. sudo mkdir -p /opt/local/var/macports/sources/ cd /opt/local/var/macports/sources/ sudo svn co . N.B. In the last line beginning `svn co ...` the trailing directory separator is significant! Now tell MacPorts to use the local checkout rather than rsync. Edit `/opt/local/etc/macports/sources.conf` and add a new line to the end with the path to the ports tree, then comment out the previous line that uses rsync. Here are the last lines from my configuration: #rsync:// [default] file:///opt/local/var/macports/sources/ [default] Finally you must create an index for the tree (otherwise you will see messages saying "Warning: No index(es) found!"). cd /opt/local/var/macports/sources/ sudo portindex Now go do great things. [mysqldb]: [macports]: [1058]: [mysql]: [python]: [django]: [rsync]: [svn]:

7 thoughts on “Using MacPorts behind a firewall

  1. Pingback: Reliably Broken » Running Django on Mac

  2. dalan

    Hey david,

    I’m not familiar with svn, after checking it out how can I make sure that my local repo is updated?


  3. michael

    Can I ask what the easiest way is to update macports, and anything installed when this method has been used, I seem to be a little stumped at the moment.

  4. Bruce

    In appending text to your .profile, the “heredoc” marker should be quoted to prevent expansion of the variables, thus:

    cat >> ~/.profile <<\EOF

Leave a Reply

Your email address will not be published. Required fields are marked *