Update MacPorts via rsync Behind a Firewall Over SSH

Update: I found an even better approach to update over https. What’s not so clear in that link is to use sudo port sync instead of sudo port selfupdate for subsequent syncing. (29 Oct 2014)

If you’re stuck behind a firewall and can’t access rsync to update MacPorts, but ssh is available and you have a server on the Internet, here is a quick fix (assuming you have MacPorts installed)

Step 1: Update the MacPorts config

While quite simple to change, this config option took me a while to find. Credit to Nikolas Mayr.

$ vim /opt/local/etc/macports/macports.conf

Find the line with “rsync_server” and change to this (or whatever port number your prefer):

rsync_server		localhost:12345

Step 2: Tunnel to your server

Nothing fancy here. Just open an SSH tunnel to forward rsync traffic through your server.

ssh -L 12345:rsync.macports.org:873 -lyour_user your.server.example.com

That’s it.

Leave a Reply