Ruby 2.6.6 in Mac m2 - ruby

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.

Related

How to install Ruby 3.1.0 on MacOS Monterey

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..

Can't install ruby 1.8.7 Mac OS X Sierra

I'm trying to (re-)install ruby 1.8.7 using rvm 1.29.1 on a brand new MBP running OS X Sierra. I HAVE to get this done for work, I'm not in a position to switch to a more current version or anything unfortunately.
I had a functional install of this but after getting some weird errors in a project decided to try a completely clean reinstall of both rvm (and eventually homebrew!) (long story- had a broken file structure after removing an unwanted space from the name of my home directory!). I was careful to remove all traces of the old install from .bashrc, .profile etc following other posts on here. 2.4.0 installs and runs fine. However, on trying to install 1.8.7:
9bxbniv1:~ Rob$ rvm install ruby-1.8.7
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..
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl#1.1/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/Rob/.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/Rob/.rvm/src/ruby-1.8.7-p374....
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/1.8.7/no_sslv2.diff.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/GH-488.patch.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/ssl_no_ec2m.patch.
ruby-1.8.7-p374 - #configuring...............................
ruby-1.8.7-p374 - #post-configuration.
ruby-1.8.7-p374 - #compiling................................
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/Rob/.rvm/log/1488471654_ruby-1.8.7-p374/make.log
^
openssl_missing.c:107:28: error: dereferencing pointer to incomplete type
EVP_MD_CTX_cleanup(&ctx->o_ctx);
^
openssl_missing.c:108:28: error: dereferencing pointer to incomplete type
EVP_MD_CTX_cleanup(&ctx->md_ctx);
^
In file included from /usr/include/string.h:192:0,
from openssl_missing.c:19:
openssl_missing.c:109:27: error: invalid application of 'sizeof' to incomplete type 'HMAC_CTX'
memset(ctx, 0, sizeof(HMAC_CTX));
^
make[1]: *** [openssl_missing.o] Error 1
make: *** [all] Error 1
+++ return 2
There has been an error while running make. Halting the installation.
To proceed rvm requires a ruby-1.8.7-p374 compatible ruby is installed.
We attempted to install it automatically but it failed with status 2.
Please install it manually (or a compatible alternative) to proceed.
I have tried some of the hacks suggested in Getting Ruby 1.8.7 installed on Mountain Lion (10.8) but unfortunately that didn't help.
Looking further into the log file the error begins with the following message:
In file included from openssl_missing.c:22:0:
openssl_missing.h:79:35: error: macro "EVP_MD_CTX_create" passed 1 arguments, but takes just 0
EVP_MD_CTX *EVP_MD_CTX_create(void);
^
In file included from /usr/local/opt/openssl#1.1/include/openssl/x509.h:23:0,
from /usr/local/opt/openssl#1.1/include/openssl/x509_vfy.h:17,
from openssl_missing.c:16:
/usr/local/opt/openssl#1.1/include/openssl/evp.h:501:51: error: expected declaration specifiers or '...' before '(' token
# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx))
Searching for the first line of this error returned 0 results on here. Suggestions would be gratefully received.
I was able to get this working via RVM using a variant of rbenv code I found # https://gist.github.com/davidkellis/909449e13905d8bfbd49c30d20f7fbca . I already had xcode and openssl.
rvm install 1.8.7 --with-openssl-dir=`brew --prefix openssl`
The latest development version of RVM should work:
rvm get head
I also updated XCode to version 8.2.1 before I upgraded RVM, if you do upgrade XCode you'll need to launch it and agree the new license or:
sudo xcodebuild -license
I had to upgrade my brew as well and do loads to get it working as it hadn't been touched for a very long time.
I'm not sure if you could just do one in isolation. Mine is up and running now.
I nuked my RVM as I had let it get out of hand. Wish I had just pruned it instead. Now to get the legacy Rails apps up and running.
Ruby 1.8.7 is dead and no longer supported on any modern macOS, so you can't install it. That version of Ruby is a historical artifact at this point, and if you really, really do need to run it, you'll either need to get a historical version of OS X, Linux or BSD which is compatible with it.
My advice is to use Vagrant to build a virtual machine that has an older version of Linux or BSD which can be used to build Ruby 1.8.7. Anything dating from 2010 or earlier will probably work, so Ubuntu 10.04 might be a good place to start.
It's worth noting that Ruby Enterprise Edition is a variant of 1.8.7 that was supported longer than MRI 1.8.7 was, so you may have more success with that version. It was discontinued in 2012.
I ended up restoring my system using time machine. But another colleague had the same problems setting things up on a new machine, and found
rvm install ruby -v 1.8.7--autolibs=enable
helpful, if anyone else stumbles across this.

Error running '__rvm_make -j 1' during rvm Ruby installation | openssl error

You are probably searching for Error running '__rvm_make -j 1'
That only says, that something went wrong while compiling ruby. This question is only relevant to you if openssl and/or ossl_ssl is part of your error message.
But maybe your problem is a similar one and you can solve your problem with some customizations.
Background
Today I wanted to delete all gems of a project but forgot to specify a path for bundler beforehand so all gems where installed in ~/.rvm/gems/ruby-2.2.4/gems/.
As it's the only ruby 2.2.4 project I though rm -rf ~/.rvm/gems/ruby-2.2.4/gems/* would be perfectly fine. It wasn't. Bundler was gone and gem install bundler didn't worked anymore as well.
I removed the hole ruby installation with rvm remove ruby-2.2.4 ant tried to reinstall it. This is the console output with the error I got:
Console output
> rvm install ruby-2.2.4
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.11/x86_64/ruby-2.2.4.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/fkammer/.rvm/rubies/ruby-2.2.4, this may take a while depending on your cpu(s)...
ruby-2.2.4 - #downloading ruby-2.2.4, 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 12.7M 100 12.7M 0 0 655k 0 0:00:19 0:00:19 --:--:-- 234k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.4 - #extracting ruby-2.2.4 to /Users/fkammer/.rvm/src/ruby-2.2.4....
ruby-2.2.4 - #configuring..........................................................
ruby-2.2.4 - #post-configuration.
ruby-2.2.4 - #compiling..............................................................
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/fkammer/.rvm/log/1456431932_ruby-2.2.4/make.log
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:19:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
^~~~~
ossl_ssl.c:2217:21: error: invalid application of 'sizeof' to an incomplete type 'const struct (anonymous struct at ossl_ssl.c:115:14) []'
for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:19:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
^~~~~
9 errors generated.
make[2]: *** [ossl_ssl.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
++ return 2
There has been an error while running make. Halting the installation.
Retrying does not change anything. I also tried to completely uninstall rvm (rvm implode) and reinstall it but that was neither successful.
System
Mac OS X – El Capitan (10.11.3)
rvm 1.26.11 (latest)
Homebrew 0.9.5
Looks like there is a problem with openssl.
rvm uses homebrew as its package manager on my installation (it's the default I guess). You can ensure that with rvm autolibs homebrew.
I reinstalled openssl with
brew reinstall openssl
and saw via brew list that there was another openssl package called openssl098 installed on my system. Trying to reinstall it too caused the following error:
> brew reinstall openssl098
Error: No available formula with the name "openssl098"
I just removed the package with
brew uninstall --force openssl098
and reinstalled openssl again to be sure openssl098 wasn't a needed dependency. But it wasn't installed again.
Afterwards I tried installing ruby-2.2.4 via rvm again and it worked like a charm :) So I guess my openssl package was broken for some reason.
openssl098 has been officially removed and is no longer available. Most probably you have outdated version of rvm which tries to build against the 0.9.8 branch. Update rvm to have it fixed: rvm get head. Source.
I was trying to install ruby 1.9.3 but have error as-
Error running '__rvm_make -j4'
I follow #mpapis and got my issue resolved
rvm remove 1.9.3
CC=clang rvm install 1.9.3
Now I have this setup-
rvm rubies
ruby-1.9.3-p551 [ x86_64 ]
ruby-2.1.3 [ x86_64 ]
=* ruby-2.3.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Here is the source link-
https://github.com/rvm/rvm/issues/
& this s my quote on it-
https://github.com/rvm/rvm/issues/2333
This is what worked for me. I always forget to do this. One time thing.
xcode-select --install
brew --prefix openssl # get the path you need for openssl
rvm install "ruby-2.6.4" --with-openssl-dir=PATH_TO_OPENSSL

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.

Installing Ruby - RVM - Mac OSX Mountain Lion

So I'm trying to install Ruby 1.9.3 on my Mac running Mountain Lion. I have xCode installed and up to date. I've installed RVM and now am trying to install Ruby using rvm install 1.9.3 When I run this it looks like it's going to install but gives me an error please see below:
rvm install 1.9.3
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p392.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Already up-to-date.
Certificates in '/Users/Colin/.rvm/etc/openssl/cert.pem' already are up to date.
Installing Ruby from source to: /Users/Colin/.rvm/rubies/ruby-1.9.3-p392, this may take a while depending on your cpu(s)...
ruby-1.9.3-p392 - #downloading ruby-1.9.3-p392, this may take a while depending on your connection...
ruby-1.9.3-p392 - #extracted to /Users/Colin/.rvm/src/ruby-1.9.3-p392 (already extracted)
ruby-1.9.3-p392 - #configuring........
Error running './configure --prefix=/Users/Colin/.rvm/rubies/ruby-1.9.3-p392 --with-opt-dir=/Users/Colin/.rvm/opt/libyaml:/Users/Colin/.rvm/opt/readline:/Users/Colin/.rvm/opt/libxml2:/Users/Colin/.rvm/opt/libxslt:/Users/Colin/.rvm/opt/libksba:/Users/Colin/.rvm/opt/openssl:/Users/Colin/.rvm/opt/sqlite --disable-install-doc --without-tcl --without-tk --enable-shared',
please read /Users/Colin/.rvm/log/ruby-1.9.3-p392/1366429269_configure.log
There has been an error while running configure. Halting the installation.
When I go to the /1366429269_configure.log file it says this:
[2013-04-19 20:41:09] ./configure
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin12.2.1
checking host system type... x86_64-apple-darwin12.2.1
checking target system type... x86_64-apple-darwin12.2.1
checking whether the C compiler works... no
configure: error: in `/Users/Colin/.rvm/src/ruby-1.9.3-p392':
configure: error: C compiler cannot create executables
See `config.log' for more details
If anyone could help me out it would be greatly appreciated!
Edit:
I tried the solution here Can't install Ruby under Lion with RVM – GCC issues rvm install 1.9.3 --with-gcc=clang and it changed a bit, here is the new output:
rvm install 1.9.3 --with-gcc=clang
Installing requirements for osx, might require sudo password.
Already up-to-date.
Certificates in '/Users/Colin/.rvm/etc/openssl/cert.pem' already are up to date.
Warning: found user selected compiler 'clang', this will suppress RVM auto detection mechanisms.
Installing Ruby from source to: /Users/Colin/.rvm/rubies/ruby-1.9.3-p392, this may take a while depending on your cpu(s)...
ruby-1.9.3-p392 - #downloading ruby-1.9.3-p392, this may take a while depending on your connection...
ruby-1.9.3-p392 - #extracted to /Users/Colin/.rvm/src/ruby-1.9.3-p392 (already extracted)
ruby-1.9.3-p392 - #configuring.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
ruby-1.9.3-p392 - #compiling..................................................................
Error running 'make -j8',
please read /Users/Colin/.rvm/log/ruby-1.9.3-p392/1366431470_make.log
There has been an error while running make. Halting the installation.
And heres the log from that: http://pastebin.com/P6nTZRQY
EDIT
Not sure what happened but I just tried the same thing and now it's working perfect. Thank you everyone who left a helpful comment, it's greatly appreciated!
You need to update Command Line Tools to latest version, also for ruby 1.9.3 it is still preferred to use gcc-4.2 for compilation.
Also make sure you update RVM before trying again:
rvm get head
rvm install 1.9.2
Finally, Ruby 2.0.0 should be compatible with 1.9.3 and you should update.
I ran into similar issues trying to install Ruby on Rails on Lion a month ago. In the end, I used an installer. If using an installer is a viable option for you, check out the Rails Installer.
try to use this it will install all
wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh

Resources