Ruby-build: Failed to install Ruby on Mac M1

Created on 4 Dec 2020  路  5Comments  路  Source: rbenv/ruby-build

Hi,

My installation of Ruby 2.7.2 failed on Mac M1.

This is the detail.

Configuration

Hardware: Mac M1
Homebrew: x86_64 version (alias brew='arch -x86_64 brew')

rbenv installation

brew install rbenv
rbenv init

.zshrc file:

alias brew='arch -x86_64 brew'
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
eval "$(rbenv init -)"

Ruby 2.7.2 installation

rbenv install 2.7.2

Current result

It fails.

Log is joined here.
ruby-build.20201204132953.28692.log

Most helpful comment

@florentmorin I'm not sure of this helps your scenario but I'm currently doing the "dual installation" approach where the ARM version of Homebrew lives in /opt/homebrew and I've aliased the Rosetta version to ibrew.
With that, I could install Ruby 2.7.2 natively with this:

% export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
% rbenv install 2.7.2
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
Installing ruby-2.7.2...
ruby-build: using readline from homebrew
Installed ruby-2.7.2 to /Users/lukas/.rbenv/versions/2.7.2

All 5 comments

@florentmorin I'm not sure of this helps your scenario but I'm currently doing the "dual installation" approach where the ARM version of Homebrew lives in /opt/homebrew and I've aliased the Rosetta version to ibrew.
With that, I could install Ruby 2.7.2 natively with this:

% export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
% rbenv install 2.7.2
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
Installing ruby-2.7.2...
ruby-build: using readline from homebrew
Installed ruby-2.7.2 to /Users/lukas/.rbenv/versions/2.7.2

see https://github.com/rbenv/ruby-build/issues/1456#issuecomment-670051168 with ARM arch. I'm not sure what status for homebrew with Rosseta2.

@lumaxis tip is what I needed, but it took me a little while to fully make sense of this tip. It worked for me but here was how I got it working. Maybe this helps someone else:

xcode-select --install
/usr/sbin/softwareupdate --install-rosetta

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
alias ibrew="arch -x86_64 brew"
ibrew update

mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
sudo mv homebrew /opt/homebrew
export PATH="/opt/homebrew/bin:$PATH"
brew update

# Just in case you have lingering ones:

ibrew uninstall rbenv ruby-build
brew uninstall rbenv ruby-build

# now the install, notice the ibrew vs brew

ibrew install ruby-build
ibrew install rbenv
brew install [email protected]
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"

rbenv install 2.7.2

Glad you got it working and sorry I wasn't more specific 馃槃 I didn't remember the exact steps I did to get there, just somehow got it working 馃檹馃徏

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kriscard picture kriscard  路  5Comments

edap picture edap  路  3Comments

Lukom picture Lukom  路  5Comments

eddroid picture eddroid  路  4Comments

denisemauldin picture denisemauldin  路  4Comments