【问题标题】:RVM - MacPorts won't update through proxyRVM - MacPorts 不会通过代理更新
【发布时间】:2013-05-07 10:04:55
【问题描述】:

我正在尝试使用 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

提前感谢您的帮助:)

【问题讨论】:

  • 您真的使用代理连接到互联网吗?当你在终端输入env 时,你看到变量http_proxy了吗?
  • 为什么选择 macports?酿造是你的朋友!你可以让 rvm 使用它,这是一个在安装 rvm 时这样做的示例:\curl -L https://get.rvm.io | bash -s stable --autolibs=homebrew 更多信息:rvm.io/rvm/autolibs

标签: ruby terminal osx-lion rvm


【解决方案1】:

虽然 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

然后通过将requirements_osx_port_update_system()函数中的selfupdate更改为sync来修改.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 $?
}

【讨论】:

    【解决方案2】:

    如果你在尝试MAKE MACPORTS WORK BEHIND PROXY,要不要避开port selfupdate

    $ diff -u .rvm/scripts/functions/requirements/osx_port.org .rvm/scripts/functions/requirements/osx_port
    --- .rvm/scripts/functions/requirements/osx_port.org 2013-05-28 16:58:37.000000000 +0900
    +++ .rvm/scripts/functions/requirements/osx_port 2013-05-28 16:58:50.000000000 +0900
    @@ -82,7 +82,7 @@
    
     requirements_osx_port_update_system()
     {
    - __rvm_try_sudo 端口 -dv selfupdate ||返回$?
    + __rvm_try_sudo 端口 -dv 同步 ||返回$?
     }
    
     requirements_osx_port_define()

    就我而言,它工作正常。

    【讨论】:

      【解决方案3】:

      在终端中运行“__rvm_try_sudo port -dv selfupdate”并通过键盘输入密码 然后重新运行脚本来安装 ruby​​

      它可以在我的笔记本电脑上使用

      祝你好运

      【讨论】:

        【解决方案4】:

        您需要先(重新)安装命令行工具:

        sudo xcode-select --install
        

        然后,更新 macports:

        sudo port -v selfupdate
        

        来源:https://stackoverflow.com/a/19634495/226255

        那么,您可能会错过一些要求:

        sudo rvm requirements
        

        【讨论】:

          猜你喜欢
          • 2017-10-05
          • 2011-04-26
          • 1970-01-01
          • 2010-10-21
          • 2011-11-22
          • 2012-01-29
          • 1970-01-01
          • 2020-01-01
          • 1970-01-01
          相关资源
          最近更新 更多