我正在尝试使用 RVM 在我的 iMac 上安装 ruby​​。

我首先输入以下内容:

rvm list known

然后,我使用以下行定位我想要安装的版本(我遵循的指南推荐 1.9.2 而不是基本的 1.8.7):
rvm install 1.9.2

然后我得到这个:
27698AM:~ butler15$ rvm install 1.9.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.7/x86_64/ruby-1.9.2-p320.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Password:

我输入我的密码,我得到这个:
DEBUG: Copying /Users/butler15/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: failed to connect to rsync.macports.org: Operation timed out (60)
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

如果我理解正确,它正在尝试更新 MacPorts,但由于位于代理(或其他什么?)

我试过遵循本指南,但没有奏效:http://samkhan13.wordpress.com/2012/06/15/make-macports-work-behind-proxy/

更多的信息:

我当前的 RVM 和 RUBY 版本:http://d.pr/i/H1Eu

我的 OSX - 10.7.4

在此先感谢您的帮助 :)

最佳答案

虽然 Koji 的评论使 RVM 在代理后工作,但 Macports 需要更新以自动在代理后工作。

首先,从 http://www.macports.org/install.php 的包中安装 macports

然后运行以下命令:

sudo mkdir -p /opt/local/var/macports/sources/svn.macports.org/trunk/dports/
cd /opt/local/var/macports/sources/svn.macports.org/trunk/dports/

sudo svn co http://svn.macports.org/repository/macports/trunk/dports/ .

在/opt/local/etc/macports/sources.conf 中注释掉
rsync://rsync.macports.org/release/tarballs/ports.tar [default]

使用您最喜欢的编辑器,然后将其添加到该行下方。
file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/ [default]

然后运行这些命令,以便它更新并且不会提示您的端口没有被索引。
sudo port -d sync
sudo portindex

然后通过在 selfupdate 函数中将 sync 更改为 requirements_osx_port_update_system() 来修改 .rvm/scripts/functions/requirements/osx_port。
requirements_osx_port_update_system()
{
  #__rvm_try_sudo port -dv selfupdate || return $?
  __rvm_try_sudo port -dv sync || return $?
}

关于ruby - RVM - MacPorts 不会通过代理更新,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16520919/

10-11 17:44