rvm pkg没有在MacOSX 10.6上安装libyaml

时间:2014-07-28 11:32:53

标签: ruby-on-rails ruby rvm

由于缺少 libyaml问题(根本没有遗漏),我无法创建Rails应用。删除RVM安装的所有rubies后,我运行了以下命令

rvm pkg install libyaml

我得到了以下输出:

rvm pkg install libyaml
Warning! PATH is not properly set up, '/Users/UserX/.rvm/gems/ruby-1.9.3-p448/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-1.9.3-p448'.

Beware, 'rvm pkg ...' is deprecated, read about the new autolibs feature: 'rvm help autolibs'.

Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Fetching yaml-0.1.6.tar.gz to /Users/UserX/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:02:08 --:--:--     0
curl: (56) Recv failure: Connection reset by peer
There was an error(56).
Checking fallback: ftp://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz
Checking fallback: http://www.mirrorservice.org/sites/pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz
No fallback URL could be found, try increasing timeout with:

    echo "export rvm_max_time_flag=20" >> ~/.rvmrc


Please note that it's required to reinstall all rubies:

    rvm reinstall all --force

我通过Homebrew检查了libyaml,它说它目前已安装。为什么我无法取得它?

rvm -v给出以下内容:

Warning! PATH is not properly set up, '/Users/UserX/.rvm/gems/ruby-1.9.3-p448/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-1.9.3-p448'.
rvm 1.25.28 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,并意识到公式中的libyaml服务器存在连接问题。

如果你看一下你得到的错误,你可以看到:

Fetching yaml-0.1.6.tar.gz to /Users/UserX/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:02:08 --:--:--     0
curl: (56) Recv failure: Connection reset by peer

你也有这个问题。 (curl: (56) Recv failure: Connection reset by peer) 我能够为此找到一个镜像,但你必须编辑brew文件。

运行brew edit libyaml

在文件注释掉当前网址并添加

url "http://dfw.mirror.rackspace.com/slackware/slackware64-14.0/patches/source/libyaml/yaml-0.1.6.tar.xz"
sha1 'f70b48d7e3696d536c399002d8c6ae9e73d0ac9c'

我选择了一张离我很近的镜子。您可以使用此列表中的一个镜像: http://mirrors.slackware.com/slackware/slackware64-14.0/patches/source/libyaml/yaml-0.1.6.tar.xz.mirrorlist

我的最终文件如下:

require 'formula'

class Libyaml < Formula
  homepage 'http://pyyaml.org/wiki/LibYAML'
  # url 'http://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz'
  url "http://dfw.mirror.rackspace.com/slackware/slackware64-14.0/patches/source/libyaml/yaml-0.1.6.tar.xz"
  sha1 'f70b48d7e3696d536c399002d8c6ae9e73d0ac9c'

  bottle do
    cellar :any
    sha1 "25a60fa0c77710616018e9b5b013916579147338" => :mavericks
    sha1 "311062934d4bd12ef9881f568dbca21d22bbc8c6" => :mountain_lion
    sha1 "69c062b4beccde415c46048dc77a14f480ba31f3" => :lion
  end

  option :universal

  def install
    ENV.universal_binary if build.universal?

    system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
    system "make install"
  end
end

当我运行brew upgrade libyaml之后,它工作正常,我能够继续(在我的情况下,我试图安装ruby 2.1.2)

希望有所帮助

- 杰克