<- Back to the HOWTO section

How to sync your ports tree using Subversion (over HTTP(s))

  • Audience: end users who cannot use rsync (873/tcp) due to firewalls, proxies, policy, etc.
  • Requires: MacPorts
  • Requires: Subversion


Some people live and work behind a firewall or proxy that blocks or otherwise breaks rsync, which is the primary means of getting updated portfiles in MacPorts. The following steps will switch your tree over to using Subversion (over https) for syncing.

Note: replace "$prefix" with the location of your MacPorts install, which defaults to /opt/local.


Step 0: Install Subversion

OS X 10.5 Leopard and later comes with Subversion already installed. If you are using Tiger, or some other system which does not provide a Subversion client, you will need to install Subversion yourself. If you have a copy of the ports tree already, just run:

sudo port install subversion

If you do not have a copy of the ports tree, you can download the daily tarball by following the tarball howto.

Step 1: Checkout Initial Copy

cd $prefix/var/macports/sources
mkdir -p
svn co .

If you prefer, the repository is also available via HTTP, which requires less configuration, but is seen as less secure (subject to a man in the middle attack).

svn co .


Step 2: Configure MacPorts

Edit $prefix/etc/macports/sources.conf to comment out the rsync entry and add the "file" entry:

Note: don't forget to replace $prefix, so the initial part will start with "file:///..." (three slashes).

#rsync:// [default]
file://$prefix/var/macports/sources/ [default]

Step 3: Configure Subversion

First, tell subversion to use your proxy to connect to the server. This should not be necessary if your initial SVN checkout was from the http or https URL's (and the checkout worked), so most people should not have to do this. If initial checkout failed, you will need this. If you needed to configure your own ~/.subversion/servers file to be able to do the initial checkout, then you *do* need this step.

  1. If the $prefix/var/macports/home/.subversion/servers file doesn't exist, create it by copying the corresponding ~/.subversion/servers file from another user to that location. (SVN automatically creates this file if it doesn't exist, so you probably already have one.)
  2. Edit the file and set a proxy for hosts at * Different proxy configurations require different sets of options here, but the file is pretty well commented, so it should be easy to figure out what you need. At a minimum you'll need settings for http-proxy-host and http-proxy-port.

Finally, if you want to use SVN over HTTPS to access the repository (i.e. if your initial SVN checkout was the https:// URL), you'll need to tell SVN to trust the MacPorts signature. (SVN doesn't trust the authority that issued it, and port sync below invokes svn up with the --non-interactive flag, so you won't have the opportunity to accept the certificate then.)

  1. mkdir -p $prefix/var/macports/home/.subversion/auth/svn.ssl.server
  2. As a normal user, run svn ls When prompted, accept the certificate permanently.
  3. SVN will store the certificate in a file in the directory $HOME/.subversion/auth/svn.ssl.server. In that directory, find the file that contains the string "" and copy it into $prefix/var/macports/home/.subversion/auth/svn.ssl.server.

Or, you can use SVN over HTTP (i.e. your initial checkout was from the http:// URL), in which case you don't need to worry about the certificate.

Step 4: Sync

Run sync in debug mode and watch for "svn update" instead of "rsync" being used. Basically, if this command works, you're good to go, and future sync's will work as well.

port -d sync 

See also

Additional topics related to MacPorts and SVN:

<- Back to the HOWTO section

Last modified 17 months ago Last modified on Jun 18, 2015, 6:14:55 PM