【问题标题】:I can't install rails on OSX 10.7.5我无法在 OSX 10.7.5 上安装 rails
【发布时间】:2013-02-26 21:29:26
【问题描述】:

每当我跑步时

    sudo gem install rails

我得到以下输出:

   ERROR:  Loading command: install (LoadError)
cannot load such file -- openssl
ERROR:  While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass

RVM 版本:rvm 1.18.14 Ruby 是 2.0.0p0

【问题讨论】:

    标签: ruby-on-rails ruby macos rvm


    【解决方案1】:

    你需要重新安装你的红宝石:

    rvm get head --autolibs=3
    rvm pkg remove
    rvm reinstall all --force
    

    新的 autolibs 支持将负责更新依赖项并将它们包含在 ruby​​ 中

    【讨论】:

    • 当我尝试重新安装时:Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/moza/.rvm/rubies/ruby-2.0.0-p0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libxml2:/usr/local/opt/libxslt:/usr/local/opt/libksba:/usr/local/opt/openssl:/usr/local/opt/sqlite --disable-install-doc --without-tcl --without-tk --enable-shared', please read /Users/moza/.rvm/log/ruby-2.0.0-p0/configure.log There has been an error while running configure. Halting the installation.
    • 您可能遇到了另一个问题,请确保运行:rvm get head 并阅读所有输出,然后使用 rvm reinstall ruby--autolibs=3 进行安装
    【解决方案2】:

    您的系统上是否安装了 Homebrew?如果是这样,请尝试

    brew install openssl
    

    在命令行中。

    【讨论】:

    • 除此之外,您还需要重新安装 Ruby 或重新编译 openssl 扩展
    • 我已经试过了:brew install openssl Warning: Your Xcode (4.5.1) is outdated Please install Xcode 4.6. Error: openssl-1.0.1e already installe
    • brew 在更新后工作但在 rails install 这是我得到的错误:/Users/moza/.rvm/bin/gem: line 6: /Users/moza/.rvm/bin/gem: Argument list too long/Users/moza/.rvm/bin/gem: line 6: /Users/moza/.rvm/bin/gem: Undefined error:
    【解决方案3】:

    嗯,你有 rvm,但为什么需要 sudo?我认为 rvm 处于沙盒模式。无论如何,错误只是意味着它找不到 ssl 路径。首先,确保您已安装 openssl。如果没有,那么您需要安装它(brew、macport 等)或rvm pkg install openssl 并让 rvm 管理其路径(您已经拥有 rvm)。之后,您将需要重新安装 ruby​​。 RVM 指南是here

    【讨论】:

      【解决方案4】:

      你不使用 sudo。 sudo 仅用于进行多用户安装,并且仅在初始安装期间使用,并将您的用户添加到 rvm 组(如果安装程序没有为您执行此操作,这通常表明您首先安装错误)

      【讨论】:

        【解决方案5】:

        我想通了!

        因此,首先我删除了与某些答案中建议的 RVM 相关的所有内容。重新启动。安装了最新版本的 Xcode 和 Xcode 的命令行工具(Xcode-prefereces-downloads)。然后再次重启,终于用上了RailsInstaller。一旦我使用了那个轨道,它就会重新启动,世界上一切都很好。感谢大家的帮助。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2012-10-29
          • 2014-05-09
          • 1970-01-01
          • 1970-01-01
          • 2012-06-28
          • 2011-04-10
          • 2013-08-14
          • 2012-12-07
          相关资源
          最近更新 更多