Ruby installation fails in macOS Catalina #1938
Replies: 22 comments 4 replies
-
As I mentioned on the other issue try following: $ brew install openssl
$ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
$ rbenv install 2.7.8 It should work (not tested on Catalina). |
Beta Was this translation helpful? Give feedback.
-
A different error but it still failed to install Downloading ruby-2.7.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0.tar.bz2
Installing ruby-2.7.0...
ruby-build: using readline from homebrew
BUILD FAILED (OS X 10.15.3 using ruby-build 20200224)
Inspect or clean up the working tree at /var/folders/s4/6_9qvyzn6kvcd2lz2jm3y_fw0000gq/T/ruby-build.20200304140824.35624.zDAaZW
Results logged to /var/folders/s4/6_9qvyzn6kvcd2lz2jm3y_fw0000gq/T/ruby-build.20200304140824.35624.log
Last 10 log lines:
lzma_bool reserved_bool2;
^
/usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool'
lzma_bool reserved_bool3;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
compiling gc.c
20 errors generated.
make: *** [file.o] Error 1
make: *** Waiting for unfinished jobs.... |
Beta Was this translation helpful? Give feedback.
-
Huh, that's weird. Why don't you create a gist with your build log and post a link here? I suspect you have stray headers in your |
Beta Was this translation helpful? Give feedback.
-
Also are your Xcode tools up to date? |
Beta Was this translation helpful? Give feedback.
-
I had this same issue with a recent install of Catalina and worked around it by ensuring that First: [~] brew install readline openssl Then (via # Setup Compiler paths for readline and openssl
local READLINE_PATH=$(brew --prefix readline)
local OPENSSL_PATH=$(brew --prefix openssl)
export LDFLAGS="-L$READLINE_PATH/lib -L$OPENSSL_PATH/lib"
export CPPFLAGS="-I$READLINE_PATH/include -I$OPENSSL_PATH/include"
export PKG_CONFIG_PATH="$READLINE_PATH/lib/pkgconfig:$OPENSSL_PATH/lib/pkgconfig"
# Use the OpenSSL from Homebrew instead of ruby-build
# Note: the Homebrew version gets updated, the ruby-build version doesn't
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$OPENSSL_PATH"
# Place [email protected] at the beginning of your PATH (preempt system libs)
export PATH=$OPENSSL_PATH/bin:$PATH
# Load rbenv
eval "$(rbenv init -)"
# Extract the latest version of Ruby so you can do this:
# rbenv install $LATEST_RUBY_VERSION
export LATEST_RUBY_VERSION=$(rbenv install -l | grep -v - | tail -1) Last: [~] source .zshrc
[~] rbenv install $LATEST_RUBY_VERSION
Downloading ruby-2.7.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.bz2
Installing ruby-2.7.1...
ruby-build: using readline from homebrew
Installed ruby-2.7.1 to /Users/tobius/.rbenv/versions/2.7.1 |
Beta Was this translation helpful? Give feedback.
-
Thank you @tobius, that worked perfectly |
Beta Was this translation helpful? Give feedback.
-
works for Catalina 10.15.5 using bash |
Beta Was this translation helpful? Give feedback.
-
@tobius is ruby-build supposed to announce that it is using home-brew readline? I can't get mine to print that regardless of the method used. |
Beta Was this translation helpful? Give feedback.
-
For what it's worth, the above solutions didn't work to install Ruby 3.0 on macOS 11.1
edit : Compilation succeeds with Xcode 12.3 and xcode-select version 2384 installed. ✅
|
Beta Was this translation helpful? Give feedback.
-
Updating of the command tools helped me: sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install |
Beta Was this translation helpful? Give feedback.
-
same problem on OSX Catalina 10.15.7 |
Beta Was this translation helpful? Give feedback.
-
@DirtyF I was trying to following what you were doing to resolve your issue and was not sure what to do. Could you help? I am trying to get ruby 2.5.1 downloaded to do course work. I confirmed that Homebrew is installed, ruby-build is installed and so is rbenv. My issue is similar to yours. I am getting a failure: WARNING: ruby-2.5.1 is nearing its end of life. ruby-build: using readline from homebrew BUILD FAILED (macOS 11.0.1 using ruby-build 20201225) Inspect or clean up the working tree at /var/folders/8q/3_kkmpr9335_5lbl29t0tnfh0000gn/T/ruby-build.20210110201435.35535.fAL4k0 Last 10 log lines: Do you know what I need to do? I have no clue how to change to " Compilation succeeds with Xcode 12.3 and xcode-select version 2384 installed. ✅" |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@DirtyF erikschulte@Eriks-MacBook-Pro ~ % xcode-select -v Downloading ruby-2.5.1.tar.bz2... WARNING: ruby-2.5.1 is nearing its end of life. ruby-build: using readline from homebrew BUILD FAILED (macOS 11.1 using ruby-build 20201225) Inspect or clean up the working tree at /var/folders/8q/3_kkmpr9335_5lbl29t0tnfh0000gn/T/ruby-build.20210112120819.73940.BmgW0u Last 10 log lines: |
Beta Was this translation helpful? Give feedback.
-
I have the same issue. If you find anything please post here. |
Beta Was this translation helpful? Give feedback.
-
@romicaiarca Hey man. What I ended up finding out is that 2.5.1 is not compatible with Big Sur or the M1 chip. 2.7.2+ is. I was able to download 2.7.2 and 3.0.0 see comments at: #1705 |
Beta Was this translation helpful? Give feedback.
-
Ok, thanks! It looks like this is not a solution for me. I need to install ruby 1.9.3 because I'm using capistrano 2 on one of my project and the client don't approve updating it. |
Beta Was this translation helpful? Give feedback.
-
You saved my day and my laptop(I was about to throw it across the room) |
Beta Was this translation helpful? Give feedback.
-
For any beings from the future, use this command to install on M1 Mac (I'm using asdf but works for rbenv as well): |
Beta Was this translation helpful? Give feedback.
-
i managed to work around this by using the homebrew gcc and symlinking it so that its picked up as the default compiler instead of the incompatible apple clang one. |
Beta Was this translation helpful? Give feedback.
-
👏 bless you @pftg That fix worked for me installing 2.7.5 on MacOS 12.0.1 Monterey after spending hours trying to reinstall ruby after messing up all my permissions/environment running One thing to note is that my xcode-select version (2392) didn't change so I guess the reinstall alone did the trick. |
Beta Was this translation helpful? Give feedback.
-
I was getting a similar problem when trying this on non m1 macbook:
After much fumbling about, the solution was these 2 things:
I did not set any environment variables (in fact, I had tried setting some based on helpful tips above and elsewhere, but even after the 2 steps above the install wouldn't succeed until I removed those extra environment variables. Note I found all these steps by running
Hope it helps someone else. |
Beta Was this translation helpful? Give feedback.
-
EDIT: Solution in comment below
I've seen the other issues #1408 #1394 #1395 but the error I'm experiencing is slightly different. This happens on any version of ruby I try to install.
I've updated
ruby-build
andrbenv
to the latest versionsBeta Was this translation helpful? Give feedback.
All reactions