I am installing macports on my Mac OS X and for fetching the binaries from the repository it uses rsync protocol. Unfortunately seems the repository is not accessible by direct connection from my machine. So I ran a local proxy program (supports http, https, ftp and socks) and now trying to find out how to redirect the rsync connection through my proxy. Is there anybody who knows about this? Cheers,


man rsync is your friend.

You may establish the connection via a web proxy by setting the environment variable RSYNC_PROXY to a host-name:port pair pointing to your web proxy. Note that your web proxy's configuration must support proxy connections to port 873.

So assuming your proxy is on port 3128, RSYNC_PROXY=localhost:3128 should do what you need.


If you use squid for your web proxy, add the two center lines to squid.conf (/etc/squid/squid.conf on most unix systems, or /opt/local/etc/squid/squid.conf in MacPorts):

acl SSL_ports port 443

acl SSL_ports port 873     # ADD THIS FOR RSYNC ACCESS
acl Safe_ports port 873    # ADD THIS FOR RSYNC ACCESS


Then, from a shell (if this works you can look at setting it up permanently), type:

export RSYNC_PROXY=proxyhost:proxyport

If your proxy requires a password:

export RSYNC_PROXY=username:password@proxyhost:proxyport

If the above is impossible for you to set up, you can also try this. It requires that you have access via ssh to a server that can act as a proxy.

export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'

The ssh server will have to have 'netcat' installed, almost all do. If not, it can be installed using something similar to:


apt-get install netcat


yum install nc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.