Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAC M1 Big Sur ruby compile issue for all rubies. Error running '__rvm_make -j8', #5033

Open
anuj-bluebash opened this issue Jan 14, 2021 · 58 comments
Assignees

Comments

@anuj-bluebash
Copy link

anuj-bluebash commented Jan 14, 2021

$rvm -v
rvm 1.29.11 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

Description

$rvm install 2.3.0
`ruby-2.3.0 - #configuring - please wait
ruby-2.3.0 - #post-configuration - please wait
ruby-2.3.0 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/sheriff/.rvm/log/1610613964_ruby-2.3.0/make.log

I have tried for almost all version and it goes failed on compile step.

Screenshot 2021-01-14 at 2 28 07 PM

@anuj-bluebash anuj-bluebash changed the title MAC M1 Big Sur ruby compile issue for all rubies. MAC M1 Big Sur ruby compile issue for all rubies. Error running '__rvm_make -j8', Jan 14, 2021
@GuillaumeCisco
Copy link

I had the same issue due to openssl.
I had to download an old version of openssl and bind it to the ruby installation.

Download : https://github.com/openssl/openssl/releases/tag/OpenSSL_1_0_2u

$> tar -xzf openssl-OpenSSL_1_0_2u.tar.gz
$> cd openssl-1.0.2u
$> ./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/openssl@1.0
$> make
$> make test
$> sudo make install
$> rvm install 2.3.8 --with-openssl-dir=/usr/local/opt/openssl@1.0

You will maybe need to run:

$> rvm osx-ssl-certs update all

@anuj-bluebash
Copy link
Author

anuj-bluebash commented Jan 15, 2021

@GuillaumeCisco
Thanks your solution work form me. Earlier I installed brew install openssl@1.0 but it was not working.

After your solution i just run arch -x86_64 rvm install 2.3.8 --with-openssl-dir=/usr/local/opt/openssl@1.0 and its working perfectly fine

Thanks

@pkuczynski
Copy link
Member

I will try to add this as default behaviour of RVM

@pkuczynski pkuczynski self-assigned this Jan 15, 2021
@anuj-bluebash
Copy link
Author

@GuillaumeCisco
I just got another issue with ruby 2.2.1.

arch -x86_64 rvm install 2.2.1 --with-openssl-dir=/usr/local/opt/openssl@1.0

Error running '__rvm_make install',
Screenshot 2021-01-15 at 4 53 15 PM

@divnoorkang
Copy link

I am trying to install ruby 2.5.5 and getting the same error. I tried @GuillaumeCisco 's solution but still showing the same error
Screenshot 2021-01-20 at 12 35 09 PM

@GuillaumeCisco
Copy link

I have the same issue for 2.2.1 :/

@pedrofurtado
Copy link
Member

@GuillaumeCisco @divnoorkang Can you guys provide the content of make.log for us? 🤝

@prsanjay
Copy link

prsanjay commented Feb 13, 2021

After following the steps added by @GuillaumeCisco I have got the below error.

Apple M1 arch

Screenshot 2021-02-13 at 1 08 53 PM

And If I follow steps given by anuj-bluebash then getting compilation error. Please find make.log

make.log

However, rvm install 2.4.10 ran successfully without any additional efforts

@whitemystyle
Copy link

whitemystyle commented Feb 17, 2021

hi, tried all variants but still have this error
Error running '__rvm_make -j8',
please read /Users/**/.rvm/log/1613567019_ruby-2.6.3/make.log

mac os 11.2

@whitemystyle
Copy link

$> tar -xzf openssl-OpenSSL_1_0_2u.tar.gz
$> cd openssl-1.0.2u
$> ./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/openssl@1.0
$> make
$> make test
$> sudo make install
$> rvm install 2.3.8 --with-openssl-dir=/usr/local/opt/openssl@1.0

tried it, openssl has been installed succesfully, but it still can't install ruby 2.6.3

@mgutenplan
Copy link

After following the steps added by @GuillaumeCisco I have got the below error. (Apple M1 using rosseta terminal)

rvm install 2.6.7 --with-openssl-dir=/usr/local/opt/openssl@1.0
ruby-2.6.7 - #removing src/ruby-2.6.7 - please wait
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/m.gutenplan/.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/m.gutenplan/.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/m.gutenplan/.rvm/log/1617704995_ruby-2.6.7/make.log

There has been an error while running make. Halting the installation.

Here is make.log file content:

There has been an error while running make. Halting the installation.
making mjit_config.h
compiling mjit_compile.c
compiling node.c
compiling numeric.c
compiling object.c
compiling pack.c
compiling parse.c
compiling proc.c
compiling process.c
compiling random.c
compiling range.c
compiling rational.c
compiling re.c
compiling regcomp.c
compiling regenc.c
compiling regerror.c
compiling regexec.c
compiling regparse.c
compiling regsyntax.c
compiling ruby.c
compiling safe.c
compiling signal.c
compiling sprintf.c
In file included from sprintf.c:1255:
./vsnprintf.c:832:8: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
                            IS_PRI_EXTRA_MARK(fmt)) {
                            ^~~~~~~~~~~~~~~~~~~~~~
./vsnprintf.c:825:34: note: expanded from macro 'IS_PRI_EXTRA_MARK'
           strncmp((s)+1, PRI_EXTRA_MARK+1, \
                          ~~~~~~~~~~~~~~^~
./vsnprintf.c:832:8: note: use array indexing to silence this warning
./vsnprintf.c:825:34: note: expanded from macro 'IS_PRI_EXTRA_MARK'
           strncmp((s)+1, PRI_EXTRA_MARK+1, \
                                        ^
compiling st.c
compiling strftime.c
compiling string.c
compiling struct.c
compiling symbol.c
1 warning generated.
compiling thread.c
compiling time.c
compiling transcode.c
compiling transient_heap.c
compiling util.c
compiling variable.c
compiling vm.c
./revision.h unchanged
compiling vm_backtrace.c
vm.c:2295:9: error: implicit declaration of function 'rb_native_mutex_destroy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        rb_native_mutex_destroy(&vm->waitpid_lock);
        ^
vm.c:2489:34: warning: expression does not compute the number of elements in this array; element type is 'const int', not 'VALUE' (aka 'unsigned long') [-Wsizeof-array-div]
                             sizeof(ec->machine.regs) / sizeof(VALUE));
                                    ~~~~~~~~~~~~~~~~  ^
vm.c:2489:34: note: place parentheses around the 'sizeof(VALUE)' expression to silence this warning
1 warning and 1 error generated.
make: *** [vm.o] Error 1
make: *** Waiting for unfinished jobs....
+__rvm_make:0> return 2

Hope we can get some answers :)

@mgutenplan
Copy link

Using rbenv and doing steps from (rbenv/ruby-build#1691 (comment)) Fixed my problem

@EdgardoRodriguezSolano
Copy link

The solutions above did not work on my case. rvm install "ruby-2.6.3" --with-out-ext=fiddle did.

@StephenVNelson
Copy link

Apple M1: I just spent hours trying to figure out what's wrong and I finally wrapped my head around it. You don't need to use an old version of SSL you just need to install your rubies with a rosetta terminal (find terminal in your applications folder, right click, get info, click "Open using Rosetta", close your terminal and reopen if you have to). after doing that you can just install any rubies you want with rvm install 2.7.3 etc.

I would change the terminal back to not open with Rosetta after you've installed whatever you needed so you're actually using your M1 chip from now on.

This can get confusing if you've tried all the stuff above like I did. You might end up with several different versions of openssl with things in your bash or zshrc path and whatnot messing everything up. You can uninstall uneeded old versions by checking out what you have with brew list and then brew uninstall openssl@1.0 etc.

@michaelsmith-st
Copy link

michaelsmith-st commented Jun 28, 2021

I didn't try SSL 1.0. I'd prefer to use current stable software, but the other ideas for rvm did not work on my M1 Mac trying to install ruby 2.6.6. All attempts result in the same error. Looks like I'll need to use rbenv.

Screen Shot 2021-06-27 at 10 27 30 AM

readline.c:1905:37: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
                                    rl_username_completion_function);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    rl_username_completion_function
readline.c:79:42: note: expanded from macro 'rl_username_completion_function'
# define rl_username_completion_function username_completion_function
                                         ^
/opt/homebrew/opt/readline/include/readline/readline.h:485:14: note: 'rl_username_completion_function' declared here
extern char *rl_username_completion_function PARAMS((const char *, int));
             ^
1 error generated.
make[2]: *** [readline.o] Error 1
make[1]: *** [ext/readline/all] Error 2
make[1]: *** Waiting for unfinished jobs....
compiling objspace.c
installing default syslog libraries
linking shared-object syslog.bundle
linking shared-object pty.bundle
compiling date_parse.c
linking shared-object digest.bundle
linking shared-object strscan.bundle
compiling date_strftime.c
installing default pty libraries
installing digest libraries
compiling objspace_dump.c
installing default digest libraries
compiling date_strptime.c
installing default nkf libraries
installing default date_core libraries
linking shared-object objspace.bundle
linking shared-object nkf.bundle
linking shared-object date_core.bundle
make: *** [build-ext] Error 2
+__rvm_make:0> return 2

@rebase-master
Copy link

I had similar issues. I tried all the possible steps to fix the compilation issues but it was not until I updated xcode on MacOS Big Sur that it succeeded.

@MissyDyan
Copy link

I had similar issues. I tried all the possible steps to fix the compilation issues but it was not until I updated xcode on MacOS Big Sur that it succeeded.

I installed Xcode and it worked for me too! No more rvm errors.

@hardik-snpwr
Copy link

I run this command "rvm install 2.6.6 --with-out-ext=fiddle" but after installation rvm list shows broken.
Screen Shot 2021-08-03 at 10 26 29 AM

@namratasaun
Copy link

@steady-daddy and @MissyDyan what exactly did you do after installing xcode?
I installed xcode and ran rvm reinstall ruby-2.3.4 and still getting the same error. I also tried everything in this thread before installing xcode but nothing worked.
I am on Mac OS 11.5.1

@MissyDyan
Copy link

MissyDyan commented Aug 4, 2021

@steady-daddy and @MissyDyan what exactly did you do after installing xcode?
I installed xcode and ran rvm reinstall ruby-2.3.4 and still getting the same error. I also tried everything in this thread before installing xcode but nothing worked.
I am on Mac OS 11.5.1

For users on Mac (I am on 11.2) with M1, Big Sur (this is what I did - what I needed for my school):
install Xcode (update it if you already have it) -- I had to install Xcode;
https://apps.apple.com/us/app/xcode/id497799835?mt=12

then run validation in the terminal to see what failed:
curl -so- https://raw.githubusercontent.com/learn-co-curriculum/flatiron-manual-setup-validator/master/manual-setup-check.sh | bash 2> /dev/null

Then can install in the terminal (I had to install 2.6.1, try replacing 2.6.1 with 2.3.4 to see if it works for you):
rvm install 2.6.1
rvm docs generate-ri. <-- read what it states in the terminal, this was needed for me after it ran
rvm --default use 2.6.1
rvm list (to verify)

I had to reinstall (these failed for me):
gem update --system (just in case)
gem install nokogiri
gem install learn-co

For other failed items:
https://github.com/learn-co-curriculum/environment-mac-os-catalina-setup

Hope it helps.

@namratasaun
Copy link

Thank you for your reply @MissyDyan .
I tried rvm install 2.3.4 after re-installing xcode and it fails. So I do not proceed further.
The error is for openssl, even tho I am giving it the path to open ssl directory

@MissyDyan
Copy link

Thank you for your reply @MissyDyan .
I tried rvm install 2.3.4 after re-installing xcode and it fails. So I do not proceed further.
The error is for openssl, even tho I am giving it the path to open ssl directory

Rosetta?
Did you duplicate your terminal? The duplicate terminal - open using Rosetta (right click "Get Info", click "Open using Rosetta")? Use the duplicate terminal for your work.

@0x2C6
Copy link

0x2C6 commented Aug 5, 2021

The solutions above did not work on my case. rvm install "ruby-2.6.3" --with-out-ext=fiddle did.

this worked for me. it actually failed during compilation so i had to add export optflags="-w" to skip compilation time errors

@3minus1
Copy link

3minus1 commented Aug 6, 2021

For people trying to install older versions of Ruby (< 2.3) on arm64, this might help!

@christianclarke
Copy link

christianclarke commented Feb 4, 2022

The error that I get for installing 2.7.3. I was able to install Ruby 3.0.0 & 2.4.1

I've got M1 Pro with MacOS Monterey

I'm scratching my head on that. Is anyone able shed any light on this ?

➜  ~ rvm install 2.7.3 --with-openssl-dir=/opt/homebrew/opt/openssl@1.1
ruby-2.7.3 - #removing src/ruby-2.7.3 - please wait
Installing Ruby from source to: /Users/cclarke/.rvm/rubies/ruby-2.7.3, this may take a while depending on your cpu(s)...
ruby-2.7.3 - #downloading ruby-2.7.3, this may take a while depending on your connection...
ruby-2.7.3 - #extracting ruby-2.7.3 to /Users/cclarke/.rvm/src/ruby-2.7.3 - please wait
ruby-2.7.3 - #configuring - please wait
ruby-2.7.3 - #post-configuration - please wait
ruby-2.7.3 - #compiling - please wait
ruby-2.7.3 - #installing - please wait
Error running '__rvm_make install',
please read /Users/cclarke/.rvm/log/1643980944_ruby-2.7.3/install.log
There has been an error while running make install. Halting the installation.
➜  ~ cat /Users/cclarke/.rvm/log/1643980944_ruby-2.7.3/install.log
+__rvm_make:0> make install
./revision.h unchanged
generating arm64-darwin21-fake.rb
arm64-darwin21-fake.rb updated
	BASERUBY = /Users/cclarke/.rvm/rubies/ruby-3.0.0/bin/ruby --disable=gems
	CC = gcc
	LD = ld
	LDSHARED = gcc -dynamiclib
	CFLAGS = -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -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 -std=gnu99 -fno-common -pipe -m64
	XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/arm64-darwin21 -I./include -I. -I./enc/unicode/12.1.0
	CPPFLAGS = -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
	DLDFLAGS = -L/opt/homebrew/opt/openssl@1.1/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -install_name /Users/cclarke/.rvm/rubies/ruby-2.7.3/lib/libruby.2.7.dylib -compatibility_version 2.7 -current_version 2.7.3  -fstack-protector-strong -framework Security -framework Foundation  -fstack-protector-strong -framework Security -framework Foundation  -m64
	SOLIBS = -lpthread -ldl -lobjc
	LANG = en_GB.UTF-8
	LC_ALL =
	LC_CTYPE =
	MFLAGS =
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
generating enc.mk
making srcs under enc
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h unchanged
generating makefiles ext/configure-ext.mk
ext/configure-ext.mk updated
generating makefile exts.mk
exts.mk unchanged
linking shared-object io/nonblock.bundle
./revision.h unchanged
*** Following extensions are not compiled:
gdbm:
	Could not be configured. It will not be installed.
	Check ext/gdbm/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
making enc
make[1]: Nothing to be done for `enc'.
making trans
make[1]: Nothing to be done for `./enc/trans'.
making encs
make[1]: Nothing to be done for `encs'.
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems -r./arm64-darwin21-fake ./tool/rbinstall.rb --make="/Library/Developer/CommandLineTools/usr/bin/make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --exclude=doc
make: *** [do-install-nodoc] Killed: 9
+__rvm_make:0> return 2

@msmendoza
Copy link

arch -arm64 rvm install ruby worked for me. The above solutions didn't.

@mcordero-ias
Copy link

None of the above worked for me.
I had luck in the past with the lflags and cflags, but no more. I ended up doing lots of stuff, I don't know what did the trick but what ended up working was the following.
I have a Mac M1 Monterey
Installed xcode with
xcode-select --install
Then I removed RVM with rvm implode
And manually erased the rvm folder
rm -rf .rvmrc && rm -rf .rvm
Reinstall rvm with \curl -sSL https://get.rvm.io | bash
Install open ssl rvm pkg install openssl
rvm install 2.7.2 --with-openssl-dir=$HOME/.rvm/usr

And This finally worked for me.

@tiagosantos
Copy link

tiagosantos commented Feb 16, 2022

Hello everyone! I had the same issue with ruby ​​2.6.6 and the solution that worked for me was:

run export warnflags=-Wno-error=implicit-function-declaration

and then:

run rvm install 2.6.6

I tried it with rvm install 2.7 and that works too.

Sometimes we need to reinstall brew or run xcode-select --install.

Log:


rvm install 2.7                                                                                                                                                                                 ✘ 22
Warning! PATH is not properly set up, /Users/carlostiago/.rvm/gems/ruby-2.6.6/bin is not at first place.
         Usually this is caused by shell initialization files. Search for PATH=... entries.
         You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
         To fix it temporarily in this shell session run: rvm use ruby-2.6.6
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/11.6/arm64/ruby-2.7.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
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/carlostiago/.rvm/rubies/ruby-2.7.2, this may take a while depending on your cpu(s)...
ruby-2.7.2 - #downloading ruby-2.7.2, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14.0M  100 14.0M    0     0  4985k      0  0:00:02  0:00:02 --:--:-- 4984k
ruby-2.7.2 - #extracting ruby-2.7.2 to /Users/carlostiago/.rvm/src/ruby-2.7.2 - please wait
ruby-2.7.2 - #configuring - please wait
ruby-2.7.2 - #post-configuration - please wait
ruby-2.7.2 - #compiling - please wait
ruby-2.7.2 - #installing - please wait
ruby-2.7.2 - #making binaries executable - please wait
Installed rubygems 3.1.4 is newer than 3.0.9 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.2 - #gemset created /Users/carlostiago/.rvm/gems/ruby-2.7.2@global
ruby-2.7.2 - #importing gemset /Users/carlostiago/.rvm/gemsets/global.gems - please wait
ruby-2.7.2 - #generating global wrappers - please wait
ruby-2.7.2 - #gemset created /Users/carlostiago/.rvm/gems/ruby-2.7.2
ruby-2.7.2 - #importing gemsetfile /Users/carlostiago/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.2 - #generating default wrappers - please wait
ruby-2.7.2 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.2 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri

@joshlin
Copy link

joshlin commented Feb 17, 2022

Follow this I was able to install rvm 2.5.1.

 =>    ruby-2.5.1 [ broken ]
     * ruby-2.7.5 [ arm64 ]
       ruby-3.0.0 [ arm64 ]

However, I still have one legacy application with ruby 1.8.7. I am running with MacOS monterey with Apple M1. It didn't work for me and it seems not even be able to complete configuration:
rvm install 1.8.7 --with-openssl-dir="/opt/homebrew/opt/openssl@1.0" and get

Warning! Requested ruby installation which requires another ruby available - installing ruby-1.8.7-p374 first.

ruby-1.8.7-p374 - #removing src/ruby-1.8.7-p374 - please wait
Installing Ruby from source to: /Users/joshlin/.rvm/rubies/ruby-1.8.7-p374, this may take a while depending on your cpu(s)...
ruby-1.8.7-p374 - #downloading ruby-1.8.7-p374, this may take a while depending on your connection...
ruby-1.8.7-p374 - #extracting ruby-1.8.7-p374 to /Users/joshlin/.rvm/src/ruby-1.8.7-p374 - please wait
ruby-1.8.7-p374 - #applying patch /Users/joshlin/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch - please wait
ruby-1.8.7-p374 - #applying patch /Users/joshlin/.rvm/patches/ruby/1.8.7/no_sslv2.diff - please wait
ruby-1.8.7-p374 - #applying patch /Users/joshlin/.rvm/patches/ruby/GH-488.patch - please wait
ruby-1.8.7-p374 - #applying patch /Users/joshlin/.rvm/patches/ruby/ssl_no_ec2m.patch - please wait
ruby-1.8.7-p374 - #configuring - please wait
Error running 'env CFLAGS=-O2 -fno-tree-dce -fno-optimize-sibling-calls ./configure --prefix=/Users/joshlin/.rvm/rubies/ruby-1.8.7-p374 --with-openssl-dir=/opt/homebrew/opt/openssl@1.0 --without-tcl --without-tk --disable-install-doc --enable-shared',
please read /Users/joshlin/.rvm/log/1645128030_ruby-1.8.7-p374/configure.log
There has been an error while running configure. Halting the installation.

I checked the log here: /Users/joshlin/.rvm/log/1645128030_ruby-1.8.7-p374/configure.log

configure: WARNING: unrecognized options: --with-openssl-dir, --without-tcl, --without-tk
checking build system type... configure: error: /bin/sh ./config.sub -apple-darwin21.3.0 failed
configure: WARNING: cache variable ac_cv_build contains a newline

It looks like it is not able to run /bin/sh ./config.sub because of the ARM chip?

Any help will be really appreciated!

Next solution worked for me (replace /opt/homebrew with your brew --prefix)

brew install openssl@1.1

export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"

rvm autolibs disable

export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"

rvm install 2.4.1 --with-openssl-dir=/opt/homebrew/opt/openssl@1.1

Found it here and adopted for myself. Adding path to profile not necessarily. It's only needed to compile ruby and then you can use it with default PATH

work perfect with me

@pramodshinde
Copy link

pramodshinde commented Feb 18, 2022

In my case, I had to reinstall Homebrew after opening the Terminal with Rosetta. I installed Homebrew, RVM, and 2.7.2 Ruby version without Rosetta at first, which led me to some issues afterwards.

Here is how I did:

  1. Right clic Terminal from the Application/Utilities folder, Get Info, tick the "Open using Rosetta" box.
  2. Uninstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
rm -rf /opt/homebrew/*
sudo rm -rf /opt/homebrew
  1. Reinstall Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  1. Restart terminal
  2. Check Homebrew is working fine: brew doctor
  3. Reinstall openssl: brew install openssl
  4. Install Ruby: rvm install 2.7

Hi, Facing same issue, On macOS Monterey 12.2
I tried both solutions with openssl@1.0 and above but no luck any help is appreciated

rvm install ruby-2.7.5
ruby-2.7.5 - #removing src/ruby-2.7.5 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/12.2/arm64/ruby-2.7.5.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Installing required packages: autoconf, automake, libtool, pkg-config, coreutils, libyaml, libksba, readline, zlib, openssl@1.1 - please wait
Certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/pramod.shinde/.rvm/rubies/ruby-2.7.5, this may take a while depending on your cpu(s)...
ruby-2.7.5 - #downloading ruby-2.7.5, this may take a while depending on your connection...
ruby-2.7.5 - #extracting ruby-2.7.5 to /Users/pramod.shinde/.rvm/src/ruby-2.7.5 - please wait
ruby-2.7.5 - #configuring - please wait
ruby-2.7.5 - #post-configuration - please wait
ruby-2.7.5 - #compiling - please wait

ruby-2.7.5 - #installing - please wait
Error running '__rvm_make install',
please read /Users/pramod.shinde/.rvm/log/1645182399_ruby-2.7.5/install.log
There has been an error while running make install. Halting the installation.

@JPGcl
Copy link

JPGcl commented Apr 26, 2022

@GuillaumeCisco Thanks your solution work form me. Earlier I installed brew install openssl@1.0 but it was not working.

After your solution i just run arch -x86_64 rvm install 2.3.8 --with-openssl-dir=/usr/local/opt/openssl@1.0 and its working perfectly fine

Thanks


Works for Ruby 3.0.3, on MacOS Monterrey (Silicon M1)
$ arch -arm64 rvm install 3.0.3 --with-openssl-dir=/usr/local/opt/openssl@1.0

Thaks U
Santiago (CL)


@AndyObtiva
Copy link
Member

AndyObtiva commented Jul 27, 2022

I'm having the same issue in Monterey on the M1 Chip (Mac ARM64).

% rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl                
ruby-3.0.2 - #removing src/ruby-3.0.2 - please wait
Checking requirements for osx.
Updating certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/andymaleh/.rvm/rubies/ruby-3.0.2, this may take a while depending on your cpu(s)...
ruby-3.0.2 - #downloading ruby-3.0.2, this may take a while depending on your connection...
ruby-3.0.2 - #extracting ruby-3.0.2 to /Users/andymaleh/.rvm/src/ruby-3.0.2 - please wait
ruby-3.0.2 - #configuring - please wait
ruby-3.0.2 - #post-configuration - please wait
ruby-3.0.2 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/andymaleh/.rvm/log/1658952367_ruby-3.0.2/make.log

There has been an error while running make. Halting the installation.

File content for ~/.rvm/log/1658952367_ruby-3.0.2/make.log is attached.

make.log

% rvm --version
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
% uname -a
Darwin Andys-Lexop-MacBook-Pro.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm64

I actually do need tcl/tk. If you think I should open a new Issue for this, please let me know. Perhaps, I should reinstall with Rosetta because tcl/tk might not be compatible with ARM64 processors yet. I'd rather not though.

@RomaShKeee
Copy link

I'm having the same issue in Monterey on the M1 Chip (Mac ARM64).

% rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl                
ruby-3.0.2 - #removing src/ruby-3.0.2 - please wait
Checking requirements for osx.
Updating certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/andymaleh/.rvm/rubies/ruby-3.0.2, this may take a while depending on your cpu(s)...
ruby-3.0.2 - #downloading ruby-3.0.2, this may take a while depending on your connection...
ruby-3.0.2 - #extracting ruby-3.0.2 to /Users/andymaleh/.rvm/src/ruby-3.0.2 - please wait
ruby-3.0.2 - #configuring - please wait
ruby-3.0.2 - #post-configuration - please wait
ruby-3.0.2 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/andymaleh/.rvm/log/1658952367_ruby-3.0.2/make.log

There has been an error while running make. Halting the installation.

File content for ~/.rvm/log/1658952367_ruby-3.0.2/make.log is attached.

make.log

% rvm --version
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
% uname -a
Darwin Andys-Lexop-MacBook-Pro.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm64

I actually do need tcl/tk. If you think I should open a new Issue for this, please let me know. Perhaps, I should reinstall with Rosetta because tcl/tk might not be compatible with ARM64 processors yet. I'd rather not though.

On macOS Monterey 12.1 next solution worked for me:

CFLAGS="-Wno-error=implicit-function-declaration" rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl  

For gems installation with native extensions, when bundle i failed:

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

SO answer

@deveshgarg150
Copy link

Apple M1: I just spent hours trying to figure out what's wrong and I finally wrapped my head around it. You don't need to use an old version of SSL you just need to install your rubies with a rosetta terminal (find terminal in your applications folder, right click, get info, click "Open using Rosetta", close your terminal and reopen if you have to). after doing that you can just install any rubies you want with rvm install 2.7.3 etc.

I would change the terminal back to not open with Rosetta after you've installed whatever you needed so you're actually using your M1 chip from now on.

This can get confusing if you've tried all the stuff above like I did. You might end up with several different versions of openssl with things in your bash or zshrc path and whatnot messing everything up. You can uninstall uneeded old versions by checking out what you have with brew list and then brew uninstall openssl@1.0 etc.

Thanks for putting this. Just install everything using Rosetta from scratch, for older rubies.

@ttduongtran
Copy link

@GuillaumeCisco Thanks your solution work form me. Earlier I installed brew install openssl@1.0 but it was not working.

After your solution i just run arch -x86_64 rvm install 2.3.8 --with-openssl-dir=/usr/local/opt/openssl@1.0 and its working perfectly fine

Thanks

It works in my case for Ruby 3.1.2, on MacOS Ventura (Silicon M1)
arch -x86_64 rvm install 3.1.2 --with-openssl-dir=/usr/local/opt/openssl@3

Thanks!

@hotanlam
Copy link

Next solution worked for me (replace /opt/homebrew with your brew --prefix)

brew install openssl@1.1

export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"

rvm autolibs disable

export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"

rvm install 2.4.1 --with-openssl-dir=/opt/homebrew/opt/openssl@1.1

Found it here and adopted for myself. Adding path to profile not necessarily. It's only needed to compile ruby and then you can use it with default PATH

arch -x86_64 rvm install 2.3.0 --with-openssl-dir=/opt/homebrew/opt/openssl@1.1

worked with me
thank

@pbharadiya
Copy link

Below worked for me.

rvm reinstall "ruby-2.7.7" --with-openssl-dir=/opt/homebrew/etc/openssl@1.1

@malprax
Copy link

malprax commented Apr 6, 2023

uninstall homebrew and reinstall again fix it to me. Now i can install my ruby in rvm just like "rvm install 2.7.1"

@smtlaissezfaire
Copy link

Below worked for me.

rvm reinstall "ruby-2.7.7" --with-openssl-dir=/opt/homebrew/etc/openssl@1.1

Worked for me with ruby-3.1.4 on Mac OS 13.4.1 (c) (22F770820d) (Ventura)`

rvm install ruby-3.1.4 --with-openssl-dir=/opt/homebrew/etc/openssl@1.1

@garkuwa
Copy link

garkuwa commented Jul 27, 2023

try running from iterm

@MalikMohsin1
Copy link

I had the same issue due to openssl. I had to download an old version of openssl and bind it to the ruby installation.

Download : https://github.com/openssl/openssl/releases/tag/OpenSSL_1_0_2u

$> tar -xzf openssl-OpenSSL_1_0_2u.tar.gz
$> cd openssl-1.0.2u
$> ./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/openssl@1.0
$> make
$> make test
$> sudo make install
$> rvm install 2.3.8 --with-openssl-dir=/usr/local/opt/openssl@1.0

You will maybe need to run:

$> rvm osx-ssl-certs update all

thnx it worked for me

@m1771vw
Copy link

m1771vw commented Aug 22, 2023

I have a Macbook Pro and Air with M1 chip.
I had to uninstall Homebrew and reinstall it in order to install new versions of Ruby. Worked with Ruby 3.2.2.

@rebase-master
Copy link

Next solution worked for me (replace /opt/homebrew with your brew --prefix)

brew install openssl@1.1

export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"

rvm autolibs disable

export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"

rvm install 2.4.1 --with-openssl-dir=/opt/homebrew/opt/openssl@1.1

Found it here and adopted for myself. Adding path to profile not necessarily. It's only needed to compile ruby and then you can use it with default PATH

This worked for me as well on M1 Max Ventura 13.2 while installing ruby 2.7.5

@mklemersson
Copy link

Similar to previous answers above, the only way that worked for me was like this:

# most likely you need to install the openssl
# brew install openssl@x.x

rvm install 3.3.0 --with-openssl-dir=$(brew --prefix)/opt/openssl@3

@mon-b
Copy link

mon-b commented Mar 8, 2024

Similar to previous answers above, the only way that worked for me was like this:

# most likely you need to install the openssl
# brew install openssl@x.x

rvm install 3.3.0 --with-openssl-dir=$(brew --prefix)/opt/openssl@3

also the only way it worked for me (Mac Air M1, Ventura 13.2.1). Installed Ruby 3.1.0 with Homebrew 4.2.11 :)

@rokolabrovic
Copy link

This worked for me:

$ ls -l | grep openssl
lrwxr-xr-x  1 bla  admin  25 Mar 29 07:32 openssl -> ../Cellar/openssl@3/3.2.1
lrwxr-xr-x  1 bla  admin  25 Mar 29 07:32 openssl@3 -> ../Cellar/openssl@3/3.2.1
lrwxr-xr-x  1 bla  admin  25 Mar 29 07:32 openssl@3.2 -> ../Cellar/openssl@3/3.2.1

arch -x86_64  rvm install 3.3.0 --with-openssl-dir=/usr/local/opt/openssl@3.2.1

@johnofsydney
Copy link

Open using Rosetta

Thank you! I was going mad trying to install Ruby 2.3.4 on my M1 macbook. The Use Rosetta trick seemed to work straight away.

@cmunoz-nex
Copy link

I have this problem with ruby 2.6.10
Screenshot 2024-04-16 at 10 22 13 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests