我在新的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
背景与环境
- Mac OS X 10.12.3。 (塞拉利昂)
- 自制1.1.8。安装OpenSSL
- RVM 1.28.0
- Ruby 2.3.3 Rails(尝试安装最新版本)
- 环境变量(以下 OpenSSL包在Mac OS X 10.11上无法编译)已在Shell环境中设置以下变量
- LDFLAGS = -L/usr/local/opt/openssl@1.1/lib
- CPPFLAGS = -I/usr/local/opt/openssl@1.1/include
- PKG_CONFIG_PATH = /usr/local/opt/openssl@1.1/lib/pkgconfig
发现和故障诊断
从一台干净的笔记本电脑开始,我按照通常的方式安装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
下一步
目前我陷入困境 - 无法通过此步骤或通过审查其他帖子进行验证以获得有效的解决方案。