Tried multiple solutions:
- SO
- RVM GitHub (also participated in the discussions)
Actually, fail to install another Ruby version (3.1.0 is installed without issues) on Apple M1 chip macOS Monterey.
So here are installed versions details:
➜ ~ which openssl
/opt/homebrew/opt/openssl@3/bin/openssl
➜ ~ openssl version -a
OpenSSL 3.0.1 14 Dec 2021 (Library: OpenSSL 3.0.1 14 Dec 2021)
built on: Tue Dec 14 16:16:25 2021 UTC
platform: darwin64-arm64-cc
options: bn(64,64)
compiler: clang -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -D_REENTRANT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
OPENSSLDIR: "/opt/homebrew/etc/openssl@3"
ENGINESDIR: "/opt/homebrew/Cellar/openssl@3/3.0.1/lib/engines-3"
MODULESDIR: "/opt/homebrew/Cellar/openssl@3/3.0.1/lib/ossl-modules"
Seeding source: os-specific
CPUINFO: OPENSSL_armcap=0x7f
Here are the lines added to the .zshrc
file following the openssl
setup:
export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
Used RVM version:
➜ ~ rvm -v
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
When installing a Ruby version (no matter, 3.0.0 or lower, for example, 2.6.5), it raises the error:
➜ ~ rvm install 2.6.5 --with-openssl-dir=`brew --prefix openssl`
ruby-2.6.5 - #removing src/ruby-2.6.5 - please wait
Checking requirements for osx.
Certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/serguei/.rvm/rubies/ruby-2.6.5, this may take a while depending on your cpu(s)...
ruby-2.6.5 - #downloading ruby-2.6.5, this may take a while depending on your connection...
ruby-2.6.5 - #extracting ruby-2.6.5 to /Users/serguei/.rvm/src/ruby-2.6.5 - please wait
ruby-2.6.5 - #configuring - please wait
ruby-2.6.5 - #post-configuration - please wait
ruby-2.6.5 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/serguei/.rvm/log/1647291878_ruby-2.6.5/make.log
There has been an error while running make. Halting the installation.
Here is the content of the created log file:
+__rvm_make:0> make -j8
BASERUBY = /Users/serguei/.rvm/rubies/ruby-3.1.0/bin/ruby --disable=gems
CC = gcc
LD = ld
LDSHARED = gcc -dynamiclib
CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -fno-common -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN
CPPFLAGS = -I/opt/homebrew/opt/openssl@3/include -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/-darwin21 -I./include -I. -I./enc/unicode/12.1.0
DLDFLAGS = -L/opt/homebrew/opt/openssl@3/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -install_name /Users/serguei/.rvm/rubies/ruby-2.6.5/lib/libruby.2.6.dylib -compatibility_version 2.6 -current_version 2.6.5 -fstack-protector-strong -framework Security -framework Foundation -fstack-protector-strong -framework Security -framework Foundation
SOLIBS = -lpthread -ldl -lobjc
LANG =
LC_ALL =
LC_CTYPE = UTF-8
Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
...
ast.c:132:19: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
rb_funcall(f, rb_intern("set_encoding"), 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
...
2 warnings generated.
linking shared-object cgi/escape.bundle
6 warnings generated.
linking shared-object psych.bundle
4 warnings generated.
linking shared-object zlib.bundle
422 warnings generated.
linking shared-object date_core.bundle
make: *** [build-ext] Error 2
+__rvm_make:0> return 2
The only successfully installed version is 3.1.0
:
➜ ~ rvm list
=* ruby-3.1.0 [ arm64 ]
# => - current
# =* - current && default
# * - default
Any idea ?