Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location: /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
--->  Updating MacPorts base sources using rsync
rsync: getaddrinfo: rsync.macports.org 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://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
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 http://google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
$> ping google.com
ping: cannot resolve google.com: Unknown host
share|improve this question

1 Answer 1

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 http://rsync.macports.org:873, 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=http://proxy.example.com:8080

    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)

    export RSYNC_PROXY=proxy.example.com:8080

    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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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