Update MacPorts via rsync Behind a Firewall Over SSH

October 13, 2014 – tagged as linux, macports, rsync, ssh

Update (29 Oct 2014): 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.

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.


Email mark@markmcb.com with questions, comments, or links to external discussions.
Privacy Note: I will not post your email address in the comments unless you request it.

No comments yet. Be the first!