我在新的Mac笔记本电脑上遇到了设置RVM + Rubies的问题,在安装了RVM和Homebrew之后,Rails的安装就出现了错误:
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
背景和环境
发现&故障诊断
从一台干净的笔记本电脑开始,我遵循了安装Homebrew,Xcode命令行工具,MySQL(用于rails dev),Git和RVM的通常路径。即使设置了环境变量以及卸载和重建RVM,在Homebrew中删除并重新添加OpenSSL,在尝试安装Rails时我也会遇到错误:
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
要注意的另一个问题是,在安装RVM时,我确保RVM知道Homebrew:
rvm autolibs enable
ram autolibs homebrew
安装ruby-2.3.3的输出如下:
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/osx/10.12/x86_64/ruby-2.3.3.tar.bz2
Checking requirements for osx_brew.
Updating Homebrew...
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
ruby-2.3.3 - #configure
ruby-2.3.3 - #download
ruby-2.3.3 - #validate archive
ruby-2.3.3 - #extract
ruby-2.3.3 - #validate binary
Libraries missing for ruby-2.3.3: /Users/travis/.rvm/rubies/ruby-2.3.3/lib/libruby.2.3.0.dylib. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for osx_brew.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/grantsayer/.rvm/rubies/ruby-2.3.3, this may take a while depending on your cpu(s)...
ruby-2.3.3 - #downloading ruby-2.3.3, this may take a while depending on your connection...
ruby-2.3.3 - #extracting ruby-2.3.3 to /Users/grantsayer/.rvm/src/ruby-2.3.3
后续步骤
目前我被困 - 无法通过此步骤或通过审核其他帖子进行验证,以获得有效的解决方案。
答案 0 :(得分:15)
我找到了解决之前描述的问题的方法。以下步骤概述了解决方法。
<强>清理强>
通过ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
通过rvm implode
<强>重建强>
使用ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
使用brew upgrade
后跟brew doctor
\curl -sSL https://get.rvm.io | bash -s stable
autolibs
rvm autolibs homebrew
选项了解自制软件
设置环境变量,以便我们知道openssl的安装位置:
导出LDFLAGS = -L / usr / local / opt / openssl / lib
导出CPPFLAGS = -I / usr / local / opt / openssl / include
export PKG_CONFIG_PATH = / usr / local / opt / openssl / lib / pkgconfig
通过rvm install 2.3.3 --autolibs=homebrew
检查它是否有效
使用rvm osx-ssl-certs status all
检查rvm空间是否了解OpenSSL证书。运行此命令会产生以下输出:Certificates for /usr/local/etc/openssl/cert.pem: Up to date.
通过gem install rails
在最后一步安装成功并且Rails正在工作(最后!)
答案 1 :(得分:0)
如果这对另一位读者不起作用 - 试试这个:
rvm get branch /bugfix/3923_set_osx_brew_openssl_compiler_config
rvm install 2.4.0
如果这对你有用,go to the rvm issue并告诉开发人员你多么欣赏他的努力:)