我刚刚安装了macport,但是selfupdate失败。我怀疑这是因为我在公司网络中位于代理后面,但无法弄清楚如何解决它。
对于背景,我设置了代理:
$> typeset -p http_proxy
declare -x http_proxy="http://proxy:8080"
但是macports失败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
有趣的是,curl
成功但ping
失败:
$> 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