How to install Ruby 3.1.0 on MacOS Monterey - ruby

I am trying to install Ruby 3.1.0 using RVM on MacOS Monterey, v12.0.1, but it's returning an error while compiling.
I tried updating Homebrew, and uninstalling and reinstalling everything but I am getting the same error.
This is the error in the terminal window:
ruby-3.1.0 - #removing src/ruby-3.1.0 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/12.0/x86_64/ruby-3.1.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
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/sindhuja.n/.rvm/rubies/ruby-3.1.0, this may take a while depending on your cpu(s)...
ruby-3.1.0 - #downloading ruby-3.1.0, this may take a while depending on your connection...
ruby-3.1.0 - #extracting ruby-3.1.0 to /Users/sindhuja.n/.rvm/src/ruby-3.1.0 - please wait
ruby-3.1.0 - #configuring - please wait
ruby-3.1.0 - #post-configuration - please wait
ruby-3.1.0 - #compiling - please wait
Error running '__rvm_make -j12',
please read /Users/sindhuja.n/.rvm/log/1643979372_ruby-3.1.0/make.log
There has been an error while running make. Halting the installation.
This is the error log file:
building .ext/include/x86_64-darwin21/rb_mjit_min_header-3.1.0.h
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h updated
linking shared-library libruby.3.1.dylib
error in initial header file:
In file included from /var/folders/ky/347m_s3x7d15w435j_pvl2cc0000gn/T/20220204-43863-1rn0v3.c:1:
/var/folders/ky/347m_s3x7d15w435j_pvl2cc0000gn/T/20220204-43863-34xdve.h:7176:66: fatal error: expected identifier or '('
pthread_override_qos_class_end_np(pthread_override_t __override);#pragma clang assume_nonnull end
^
1 error generated.
make: *** [.ext/include/x86_64-darwin21/rb_mjit_min_header-3.1.0.h] Error 1
make: *** Waiting for unfinished jobs....
+__rvm_make:0> return

I had the same error for rbenv 3.1.0 with Monterey12.3beta & Xcode13.3beta.
but once I switched to Xcode13.0, the error's gone.
I guess the error's due to or related to clang version..

Related

Ruby 2.6.6 in Mac m2

Has anyone managed to install version 2.6.6 on a mac m2?
I get this error when trying to install:
$ ruby-install ruby 2.6.6
exts.mk updated
compiling strscan.c
linking shared-object strscan.bundle
Undefined symbols for architecture x86_64:
...
"_rb_warning", referenced from:
_strscan_clear in strscan.o
_strscan_getbyte in strscan.o
_strscan_peep in strscan.o
_strscan_empty_p in strscan.o
_strscan_restsize in strscan.o
"_ruby_xfree", referenced from:
_strscan_free in strscan.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../../.ext/x86_64-darwin22/strscan.bundle] Error 1
make[1]: *** [ext/strscan/all] Error 2
make: *** [build-ext] Error 2
In RVM:
rvm install 2.6.6 phoenix-api/git/improve/rm_study_gfk_and_import_bugs !
ruby-2.6.6 - #removing src/ruby-2.6.6 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/13.2/x86_64/ruby-2.6.6.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing Ruby from source to: /Users/rrmartins/.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...
ruby-2.6.6 - #extracting ruby-2.6.6 to /Users/rrmartins/.rvm/src/ruby-2.6.6 - please wait
ruby-2.6.6 - #configuring - please wait
ruby-2.6.6 - #post-configuration - please wait
ruby-2.6.6 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/rrmartins/.rvm/log/1676579014_ruby-2.6.6/make.log
There has been an error while running make. Halting the installation.
I tried install with ruby-install 2.6.6 and rvm install 2.6.6
anybody can help me! tks
This issue was reported on GitHub in the rbenv/ruby-build repo.
It was responded to by hsbt, a core contributor to Ruby, who pointed the user to the Ruby mailing list issue #18912, where they said:
TL;DR: We fixed this issue at Ruby 2.7-3.1 and master branch. But the stable versions are not released yet.
Option 1: We strongly recommend to not upgrade Xcode 14 and its toolchains for macOS 12(Monterey) users. If you already update Xcode 14, you remove them with sudo rm -rf /Library/Developer/CommandLineTools and install Xcode 13.x or toolchains from https://developer.apple.com/download/all
Option 2: macOS 13 (Ventura) couldn't install Xcode13. We should add --without=+,bigdecimal --enable-shared to the configure option.
Unfortunately for you, if you have an M2 Mac then you likely have macOS Ventura. None of these instructions will help you because you can't downgrade macOS or the Xcode Command Line tools.
In your case, I would advise that you make the effort to upgrade your version of Ruby rather than jump through any of these hoops because it's unlikely that you'll succeed in compiling it. Ruby 2.6 hit end-of-life nearly a year ago and 2.7 will do the same in about a month -- it's time to upgrade.

Failure installing rvm on Windows 10 using cygwin64... __rvm_make -j8

Trying to install rvm on Windows 10 using cygwin64.
Have updated path to include cygwin64\bin to get past some other issues.
Now it's failing after significant progress...
$ rvm install "ruby-2.5.3"
ruby-2.5.3 - #removing src/ruby-2.5.3..
Searching for binary rubies, this might take some time.
No binary rubies available for: cygwin/unknown/x86_64/ruby-2.5.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for cygwin.
Requirements installation successful.
Installing Ruby from source to: /home/wmbra/.rvm/rubies/ruby-2.5.3, this may take a while depending on your cpu(s)...
ruby-2.5.3 - #downloading ruby-2.5.3, this may take a while depending on your connection...
ruby-2.5.3 - #extracting ruby-2.5.3 to /home/wmbra/.rvm/src/ruby-2.5.3.....
ruby-2.5.3 - #configuring...................................................................
ruby-2.5.3 - #post-configuration..
ruby-2.5.3 - #compiling..............................................................
**Error running '__rvm_make -j8',
please read /home/wmbra/.rvm/log/1674057369_ruby-2.5.3/make.log
**
There has been an error while running make. Halting the installation.
Looking at the last lines of make.log below, it appears that gcc is not found in bin/sh
...
compiling cygruby250.res.o
make[1]: Entering directory '/home/wmbra/.rvm/src/ruby-2.5.3'
make[1]: Nothing to be done for 'srcs'.
make[1]: Leaving directory '/home/wmbra/.rvm/src/ruby-2.5.3'
**generating transdb.h
/bin/sh: gcc -E -xc: command not found
windres: preprocessing failed.
**make: *** [GNUmakefile:48: cygruby250.res.o] Error 1
make: *** Waiting for unfinished jobs....
transdb.h updated
rm cygruby250.rc
++ return 2
gcc.exe is sitting in cygwin64/bin. Not sure what the /sh reference is.
Any help understanding / resolving would be very much appreciated!
**Tried:
**
$ rvm install "ruby-2.5.3"
**Expected:
**successful install of rvm :)
**Actual:
**
**Error running '__rvm_make -j8',
please read /home/wmbra/.rvm/log/1674057369_ruby-2.5.3/make.log

RVM install Ruby 2.1.2: configure: error: cannot compute sizeof (long long)

While installing ruby with:
rvm install 2.1.2
I am getting this error.
And I have also tried building ruby 2.1.2 and other versions as well from source, but I am getting the same error while running:
./configure
OSX Version: 10.14.2 (18C54)
Rvm Version: 1.29.4
This error started coming up after I upgraded to OSX Mojave.
Logs:
ruby-2.1.2 - #removing src/ruby-2.1.2 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.1.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/shubhams/.rvm/rubies/ruby-2.1.2, this may take a while depending on your cpu(s)...
ruby-2.1.2 - #downloading ruby-2.1.2, this may take a while depending on your connection...
ruby-2.1.2 - #extracting ruby-2.1.2 to /Users/shubhams/.rvm/src/ruby-2.1.2 - please wait
ruby-2.1.2 - #applying patch /Users/shubhams/.rvm/patches/ruby/2.1.2/openssl3.patch - please wait
ruby-2.1.2 - #configuring - please wait
Error running './configure --prefix=/Users/shubhams/.rvm/rubies/ruby-2.1.2 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --disable-install-doc --enable-shared',
please read /Users/shubhams/.rvm/log/1544095614_ruby-2.1.2/configure.log
There has been an error while running configure. Halting the installation.
Log inside "/Users/shubhams/.rvm/log/1544095614_ruby-2.1.2/configure.log":
....
checking for long long... yes
checking for off_t... yes
checking char bit... 8
checking size of int... 0
checking size of short... 0
checking size of long... 0
checking size of long long... configure: error: in
/Users/shubhams/.rvm/src/ruby-2.1.2':
configure: error: cannot compute sizeof (long long)
Seeconfig.log' for more details
Thanks.
As noted in the comments, renaming the /usr/local/include directory does solve this particular issue. This works because the installer script can no longer find the file causing the problem, previously located in the folder formerly known as /usr/local/include.
While this works, it is likely you'll later encounter issues with homebrew formulaes (stuff already installed on your machine via homebrew).
Solution:
Although this may not always be the case, I simply needed to delete /usr/local/include/stdint.h

Is it possible to install Ruby 1.9.3-p327 on OS X Mavericks? And if so, how?

I'm setting up a Mac OS X Mavericks 10.9.3 system for development.
Due to some legacy code and environments on OTHER machines, I need to use Ruby 1.9.3-p327.
However, it isn't building.
I have Xcode 5.1.1 (5B1008) installed and command line tools are installed.
I have gcc...
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix
The error I'm getting is below.
Does anyone know of a workaround for this?
$ rvm install ruby-1.9.3-p327
ruby-1.9.3-p327 - #removing src/ruby-1.9.3-p327 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-1.9.3-p327.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/opt/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/username/.rvm/rubies/ruby-1.9.3-p327, this may take a while depending on your cpu(s)...
ruby-1.9.3-p327 - #downloading ruby-1.9.3-p327, this may take a while depending on your connection...
ruby-1.9.3-p327 - #extracting ruby-1.9.3-p327 to /Users/username/.rvm/src/ruby-1.9.3-p327 - please wait
ruby-1.9.3-p327 - #applying patch /Users/username/.rvm/patches/ruby/GH-488.patch - please wait
ruby-1.9.3-p327 - #configuring - please wait
ruby-1.9.3-p327 - #post-configuration - please wait
ruby-1.9.3-p327 - #compiling - please wait
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/username/.rvm/log/1400875609_ruby-1.9.3-p327/make.log
f_rational_new_no_reduce1(VALUE klass, VALUE x)
^
6 warnings generated.
compiling re.c
compiling regcomp.c
compiling regenc.c
compiling regerror.c
compiling regexec.c
compiling regparse.c
regparse.c:582:15: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
return t->num_entries;
~~~~~~ ~~~^~~~~~~~~~~
1 error generated.
make: *** [regparse.o] Error 1
+__rvm_make:0> return 2
There has been an error while running make. Halting the installation.
I'm finding that ruby-1.9.3-p547 does install without errors, but I need the other version.
If it's not neccesary to use rvm to install this version of ruby, you can use rbenv. I just installed this exactly version without any problems. And it's easy to install it with brew.
If it won't work, then the problem in another place.

Trying to get rvm to work, but getting error running

I get the following Error when running rvm reinstall 1.9.3, I followed some advice to deleted these files and folders below, now I dont have them even after removing rvm and reinstalling with curl, what do I do? I used the rails installer, and I think that is what has messed this whole thing up. I just want to start from scratch.
rm -rf /opt/sm
rm /etc/rvmrc
rm /etc/profile.d/sm.sh
I also get this output when trying to install rvm reinstall 1.9.3
$ rvm reinstall 1.9.3
Removing /usr/local/rvm/src/ruby-1.9.3-p385...
Removing /usr/local/rvm/rubies/ruby-1.9.3-p385...
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p385.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /usr/local/rvm/archives
Extracting yaml to /usr/local/rvm/src/yaml-0.1.4
Configuring yaml in /usr/local/rvm/src/yaml-0.1.4.
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/usr/local/rvm/usr --disable-shared', please read /usr/local/rvm/log/ruby-1.9.3-p385/yaml/configure.log
Compiling yaml in /usr/local/rvm/src/yaml-0.1.4.
Error running 'make', please read /usr/local/rvm/log/ruby-1.9.3-p385/yaml/make.log
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p385, this may take a while depending on your cpu(s)...
ruby-1.9.3-p385 - #downloading ruby-1.9.3-p385, this may take a while depending on your connection...
ruby-1.9.3-p385 - #extracting ruby-1.9.3-p385 to /usr/local/rvm/src/ruby-1.9.3-p385
ruby-1.9.3-p385 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p385
ruby-1.9.3-p385 - #configuring
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --disable-install-doc --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p385 --with-opt-dir=/usr/local/rvm/usr --disable-shared', please read /usr/local/rvm/log/ruby-1.9.3-p385/configure.log
There has been an error while running configure. Halting the installation.
PLEASE help this has been taking me forever, to figure this out.
make.log
[2013-02-11 21:27:46] make
make: *** No targets specified and no makefile found. Stop.
after removing the files you need also open new terminal - if it does not help - restart computer

Resources