Comments on Installing Ruby on MacOS 12.2 (or 11.6) produces compilation errors in the downloaded source; how do I fix?
Parent
Installing Ruby on MacOS 12.2 (or 11.6) produces compilation errors in the downloaded source; how do I fix?
A project I want to work on requires Ruby. I was directed to RVM or rbenv. I tried rbenv
first because it has Mac instructions, ran into failures, uninstalled it and installed RVM, and still ran into problems. I am not sure how to debug. Details:
I am on MacOS 12.2 (was 11.6 when I first asked this). I am using the terminal (bash command line). I'll jump to the problem with RVM because the developer I'm working with uses it.
I installed RVM using the following command (from their documentation):
\curl -sSL https://get.rvm.io | bash -s stable
That did not produce any error messages. This installation modified my .bash_profile, so I fired up a new shell. In it I used rvm list known
and confirmed that the list includes [ruby-]2.6[.6]
, the version my project needs. I then typed:
rvm install "ruby-2.6.6"
Which produced a compilation error (substituting USER for my actual user name in paths):
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/USER/.rvm/rubies/ruby-2.6.6, this may take a while depending on your cpu(s)...
ruby-2.6.6 - #downloading ruby-2.6.6, 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 13.4M 100 13.4M 0 0 7961k 0 0:00:01 0:00:01 --:--:-- 7957k
ruby-2.6.6 - #extracting ruby-2.6.6 to /Users/USER/.rvm/src/ruby-2.6.6.....
ruby-2.6.6 - #configuring......................................................|
ruby-2.6.6 - #post-configuration.
ruby-2.6.6 - #compiling...................................................
Error running '__rvm_make -j8',
please read /Users/USER/.rvm/log/1637706281_ruby-2.6.6/make.log
There has been an error while running make. Halting the installation.
I consulted the log file given at the end and found a puzzling error, which I included in an earlier version of this question (you can find it in the revision history). People suggested that I needed to reinstall homebrew
because I was now running on the M1 chip. I've done that and repeated the steps to install Ruby, and this time I get a different make error:
installing default libraries
closure.c:264:14: error: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
result = ffi_prep_closure(pcl, cif, callback, (void *)self);
^
6 warnings and 1 error generated.
make[2]: *** [closure.o] Error 1
My attempt to install using rbenv
ended with a very similar error, so switching from RVM to rbenv
won't solve my problem.
How can I remedy this problem? I'm wondering if these Ruby managers require something in my environment that I'm missing, despite the output saying that dependencies were checked. Maybe it's assuming a different compiler than whatever I have? I see the reference to C99 there but don't know what it might be expecting.
This error isn't coming from my code; it's coming from the Ruby source code that RVM downloaded and tried to build. I guess I could try debugging that code, if I knew anything about it, but that seems like the wrong approach. I'm trying to get the "official" Ruby 2.6.6 to run, not my locally-hacked Ruby 2.6.6.
I don't know Ruby or its environment; I'm hoping to learn as I work on this project. Because of that lack of experience, though, I don't know where to look next or how to debug this problem. How do I successfully install this version of Ruby?
Post
Wait a minute I think you missed something, yesterday when I read your message in Discord I thought you were unable to install RVM which were producing that error. But this question clears my confusion. You were executing rvm install "ruby-2.6.6"
but that's not what we used to do.
I had written the same answer in another question of "mine". here it is (I had mentioned it in Discord either) (I don't have any idea if it's really good to link my old answer which account I had deleted, if it's bad purpose then you can edit or suggest edit). You should have execute
rvm install 2.6.6 #this will install 2.6.6 version of Ruby
rvm use 2.6.6 #you must execute it otherwise you will keep using earlier version (whichever you had in your system)
Sometimes, they don't work without being super user. So I used to use sudo
but it sometimes doesn't work also. For that reason you should execute
/bin/bash --login #I don't have idea, if the command really works in Mac
/bin/bash --login
is nearly related to su -
.
2 comment threads