MacOS X – ports behind firewall

mac ports syncing behind firewall

I have been having troubles to make any connection work in office. I new there was a problem with our firewall so I assumed the easiest way should be to tunnel it through my server. I have tried several methods and the following one works like charm and I like it the most.

Firstly in order to make it all work you have to have an account on a server which is open to world (not behind the same firewall you are).

Then you can use the ssh command to create tunnel to the server and forward your connection to correct location. I simply create the tunnel using same ports locally and remotely. It has to be done under local root use, because normal users are not allowed create connection using ports lower then 1024.


After running this command it will asks you first for your root password and then for your remote password and send the ssh into background. So you will be back in you LOCAL shell. All connections to local port 873 are being tunnelled to YOURSERVER and then forwarded further to the

Now we have to modify mac ports setting so lets make backup of it first.

sudo cp /opt/local/etc/macports /opt/local/etc/macports.original

Now we are ready to do the final modifications.

Edit as root file /opt/local/etc/macports/macports.conf and comment the line rsync_server. then copy it and change value to localhost. It should look like this:

rsync_server            localhost

The last thing we have to change is the repository location. Open file /opt/local/etc/macports/sources.conf and at the end comment the address of the rsync server and in copy of it change the server name to localhost.

#rsync:// [default]
rsync://localhost/release/ports/ [default]

Now you can use the port command as usually.





Leave a Reply