Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just installed macport but the selfupdate fails. I suspect this is because I am on corporate network behind a proxy, but can't figure out how I can fix it.

For background, I have set the proxy:

$> typeset -p http_proxy
declare -x http_proxy="http://proxy:8080"

But macports fails in getaddrinfo:

$> sudo port -d selfupdate
DEBUG: Copying /Users/i063510/Library/Preferences/ to /opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location: /opt/local/var/macports/sources/
--->  Updating MacPorts base sources using rsync
rsync: getaddrinfo: 873: nodename nor servname provided, or not known
rsync error: error in socket IO (code 10) at /SourceCache/rsync/rsync-42/rsync/clientserver.c(105) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv --delete-after rsync:// /opt/local/var/macports/sources/
Exit code: 10
DEBUG: Error synchronizing MacPorts sources: command execution failed
    while executing
"macports::selfupdate [array get global_options] base_updated"
Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: command execution failed

Interestingly, curl succeeds but ping fails:

$> curl
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<H1>301 Moved</H1>
The document has moved
<A HREF="">here</A>.
$> ping
ping: cannot resolve Unknown host
share|improve this question

You are setting a proxy for http connections. curl and your web browser use http but rsync does not. Thus explaining the errors.

Ideally you need to ask your proxy administrator to change the proxy to allow rsync through,

If not then you might be able to get sync to work over a http proxy as per this blog

There are three steps. The prerequisites required for this to work are that you have the proxy address, admin access to your mac, and that the proxy supports the rsync port (873/tcp).

You can test the connectivity by going to, you should get the following error:

@RSYNCD: 30.0
@ERROR: protocol startup error

If that works ok, then you need to set up the sudo environment for osx to let proxy environment settings through.

  1. Edit your sudoers file with sudo visudo. You need to append these lines:

    Defaults env_keep += "http_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY RSYNC_PROXY" Defaults env_keep += "ALL_PROXY NO_PROXY"

  2. Set your http proxy

    export http_proxy=

    where 8080 is the port number of the proxy

  3. Make rsync use the proxy. By default, port uses rsync to manage its updates. RSync can use a proxy environment setting (man rsync for mre)


    Note the rsync proxy capitalisation, and the fact that it does not need http://

That should do it. You can then run selfupdate to get port to the latest version.

share|improve this answer
Behind a large corporate firewell and proxy, I suspect I will not be able to get IT to make any changes. But I am hopeful this will work. Thanks. – Miserable Variable Jun 10 '13 at 22:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .