rvm install 2.6.7 always failed on Apple M1 mac
Asked Answered
S

6

12

I always get bellow error on my M1 mac while rvm install 2.6.7

enter image description here

me@xx ~ % rvm install 2.6.7
ruby-2.6.7 - #removing src/ruby-2.6.7 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/11.5/x86_64/ruby-2.6.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/opt/homebrew/etc/[email protected]/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/me/.rvm/rubies/ruby-2.6.7, this may take a while depending on your cpu(s)...
ruby-2.6.7 - #downloading ruby-2.6.7, this may take a while depending on your connection...
ruby-2.6.7 - #extracting ruby-2.6.7 to /Users/me/.rvm/src/ruby-2.6.7 - please wait
ruby-2.6.7 - #configuring - please wait
ruby-2.6.7 - #post-configuration - please wait
ruby-2.6.7 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/me/.rvm/log/1629787822_ruby-2.6.7/make.log

There has been an error while running make. Halting the installation.
Stifle answered 24/8, 2021 at 7:8 Comment(1)
Please checkout my article which resolve all issue realted to apple m1 - medium.com/@vishalsadriya1224/…Meniscus
R
11

Yes, this is a known issue upstream: https://bugs.ruby-lang.org/issues/17777 ruby-build is also tracking this issue: https://github.com/rbenv/ruby-build/issues/1489

The work around is to run the following code, and install ruby 2.6.7 again:

$ export warnflags=-Wno-error=implicit-function-declaration
$ rbenv install 2.6.7

-or-

$ CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.6.7

Looks like this can also impact gem installation with native extensions (mysql2 is one of those):

gem install <GEMNAME> -- --with-cflags="-Wno-error=implicit-function-declaration"

Referenced: Error installing ruby 2.6.7 on mac os - how to resolve?

Rothmuller answered 24/8, 2021 at 8:58 Comment(1)
For those who have trouble using rbenv follow this guide firstStifle
E
6

I had the same issue in RVM, following solution worked for me.

CFLAGS="-Wno-error=implicit-function-declaration" rvm install 2.6.0
Emmalineemmalyn answered 18/7, 2022 at 7:52 Comment(0)
P
2

I faced the same problem, the easiest way is to install 2.6.9 later version, everything will be ok.

If you really need older version ruby, you can try to use [email protected]. If it still is error. Maybe see this blog enter link description here, which doesn't use arm one.

Photomicroscope answered 28/7, 2022 at 7:32 Comment(0)
G
2

Please check this it works for me.

brew install openssl
rvm install 2.6.7 --with-openssl-dir=/usr/local/opt/openssl
Gormless answered 9/8, 2022 at 9:40 Comment(1)
You can use this rvm install 2.5.3 --with-openssl-dir=/usr/local/opt/[email protected]Gormless
S
1

Provided you have homebrew installed on an M1, these two steps seem to solve the issue.

brew install libffi

LDFLAGS="-L/opt/homebrew/opt/libffi/lib" CPPFLAGS="-I/opt/homebrew/opt/libffi/include" rvm install 2.7.7
Songstress answered 11/4, 2023 at 16:5 Comment(0)
H
0

As shown in this Issue on Github, the issue is due to the version of openssl that is used. I had to download an old version of openssl and bind it to the ruby installation.

You can download the required version here.

Then run these commands:

$> tar -xzf openssl-OpenSSL_1_0_2u.tar.gz
$> cd openssl-1.0.2u
$> ./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/[email protected]
$> make
$> make test
$> sudo make install
$> rvm install 2.6.7 --with-openssl-dir=/usr/local/opt/[email protected]

Update the version you want to use for ruby in the last command.

You will maybe need to run:

$> rvm osx-ssl-certs update all
Hedgepeth answered 16/8, 2023 at 14:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.