rvm/rvm
Workaround to install Ruby 2.x on macOS 11.6 Big Sur with MacPorts
Aperta
#5176 aperta il 24 gen 2022
good first issueplatform: macos
Metriche repository
- Star
- (4405 stelle)
- Metriche merge PR
- (Merge medio 1g 5h) (3 PR mergiate in 30 g)
Descrizione
I recently invested a significant amount of time trying to install Ruby 2.x on a new Mac using MacPorts. Apparently, the problem was that RVM was trying to build against the latest version of OpenSSL (v3) which Ruby 2.x is not compatible with.
The solution I found was:
- Install MacPorts
- Install RVM
rvm --autolibs=macports requirements $RUBY_VERSIONto install all requirements including the wrongopensslpackage.sudo port uninstall openssl openssl3to remove OpenSSL 3; to prevent the 3.x headers from being picked up during the install process.sudo port install openssl11to install OpenSSL 1.1
Then, I could install any Ruby from 2.4 to 2.7 like so:
export LDFLAGS="-L/opt/local/libexec/openssl11/lib -L/opt/local/lib"
export CPPFLAGS="-I/opt/local/libexec/openssl11/include -I/opt/local/include"
~/.rvm/bin/rvm --autolibs=disable install $RUBY_VERSION
Afterward, the openssl3 package can be reinstalled or reactivated and the RVM-installed Rubies will continue to work.
I have successfully used these steps on both an x86_64 and arm64 Mac.
Environment info
system:
system:
uname: "Darwin BRagheb-MBP16-BEI.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64 x86_64"
name: "OSX"
version: "11.6"
architecture: "x86_64"
bash: "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)"
zsh: "/bin/zsh => zsh 5.8 (x86_64-apple-darwin20.0)"
remote_path: "osx/11.6/x86_64"
xcode: "13.2.1"
rvm:
version: "1.29.12 (latest)"
updated: "11 days 11 minutes 15 seconds ago"
path: "/Users/benragheb/.rvm"
autolibs: "[read-fail] Allow RVM to use package manager if found, fail if dependencies are missing. This is default."
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/usr/bin/rake"
environment:
PATH: "/Users/benragheb/.nvm/versions/node/v12.12.0/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/benragheb/.rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""