-
Notifications
You must be signed in to change notification settings - Fork 785
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installation issues with Arm Mac (M1 Chip) #1691
Comments
I have the same problem, here is full log output to help you. Also on my new MacBook Pro with M1.
I tried different flags and absolutely no flags, aka Thanks for excellent work, and Merry Christmas. |
I only confirm to work native arm arch with M1 chip. I'm not sure what happened with the mix environment provided by Rosetta2. |
Yes.
|
Same issue here with my new MBA M1. Tried with Homebrew and Basic GitHub Checkout. |
It seems you all mix readline compiled for ARM with Ruby for x64. That will never work properly. It's not good idea to mix these platforms together. Just use separated Homebrew for ARM and for x64. @hsbt I believe the issue is in readline. |
Hi! Im also trying to install Ruby. Ive been reading your post and the following answers. Could you please advise on how to do this? Thanks! |
Hello, please have you any rollout how to setup everything properly to the working state? I need to switch my ntb at job for a new one. I just followed guidelines. I installed homebrew with rosetta2 and then |
Just open terminal and |
Hello, please how did you install natively? Using Homebrew or compilation, please can you give some details? I will try it. Thanks. |
I have solved it. I deleted Homebrew and install it natively for ARM, installed rbenv and symlinked into |
I had some success by using the latest Homebrew install script (which adds partial support for M1), then:
Update: 2020-12-29: I got 2.7.2 working by:
|
With the latest version of Homebrew I was able to install rbenv without any issues. (Also had to install openssl) |
tl;dr make sure you're using rbenv to install a recent release of Ruby, i.e. Ruby 2.7.2 instead of Ruby 2.7.1 I did this all today on a new 13" M1 MacBook Pro
I then noticed that
But following what worked for @tcannonfodder,
From there, I updated the required Ruby version in my project's Gemfile, ran
For what it's worth, the nvm install script worked fine, as well as Entertainingly, as Node compiled from source and there were 4x clang instances showing in Activity Monitor at all times for 15 minutes, my computer seemed bored and everything was ⚡ fast! Yay M1. |
I can confirm that while Ruby 2.7.1 fails to install, both 2.7.2 and 3.0.0 succeed without a problem. This echos @aguynamedben's findings immediately above. I'm curious as to why this happens, but am happy to know that I have access to a 2.7.x build for the time being. Here's the output of attempting to install each version, for the curious:
|
Update: I was running into issues with Ruby 2.7.2, where the |
Hi! I think i find a way. I just install ruby 2.7.1 using RUBY_CFLAGS="-w" rbenv install 2.7.1 Watching as the logs i saw the problem (for me) was a useless warning so i just disable -Wall with -w
I hope it works for you 😃 |
@tcannonfodder Im following your steps and while executing gem update I get the following message:
May I ask you, did you stumbled upon the same? |
If I directly try to execute So I thought I need to designate the right path, but I presume Im executing the wrong command to install Rbenv: But if I want to check the version, I dont see is the right one:
|
I just want to share my experience and to thank @amaurybernard for pointing me in the right direction:
If the ffi gem gives you any more troubles first install the latest version with While @amaurybernard disabled all warnings, I disabled just the one causing the compile issue. As it turns out this compilation issue has already been discussed for ffi |
Yeah, by prefixing any |
I also ran into this error when installing ruby 2.7.2 using RVM on M1. Fixed by installing another homebrew (arm version)
and then install readline using arm version homebrew. Then the error got fixed. |
@santostiago's solution on #1699 (comment) worked for me!
|
I got into he same issue and here is my sollution First make sure you have
Set the path to openssl and the environment variables required for ruby compilation into your
Now you should be able to install ruby in your M1 machine |
I have some problems with ruby like I read in this issue, I followed this "guide": and I have ruby working now:
hope it helps anyone :) |
I tried this solution and it still doesn't work Downloading ruby-3.0.0.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.gz
Installing ruby-3.0.0...
ruby-build: using readline from homebrew
/opt/homebrew/bin/ruby-build: line 1121: 69588 Killed: 9 "$RUBY_BIN" -e '
manager = ARGV[0]
packages = {
"apt-get" => Hash.new {|h,k| "lib#{k}-dev" }.update(
"openssl" => "libssl-dev",
"zlib" => "zlib1g-dev"
),
"yum" => Hash.new {|h,k| "#{k}-devel" }.update(
"yaml" => "libyaml-devel"
)
}
failed = %w[openssl readline zlib yaml].reject do |lib|
begin
require lib
rescue LoadError
$stderr.puts "The Ruby #{lib} extension was not compiled."
end
end
if failed.size > 0
$stderr.puts "ERROR: Ruby install aborted due to missing extensions"
$stderr.print "Try running `%s install -y %s` to fetch missing dependencies.\n\n" % [
manager,
failed.map { |lib| packages.fetch(manager)[lib] }.join(" ")
] unless manager.empty?
$stderr.puts "Configure options used:"
require "rbconfig"; require "shellwords"
RbConfig::CONFIG.fetch("configure_args").shellsplit.each { |arg| $stderr.puts " #{arg}" }
exit 1
end
' "$(basename "$(type -p yum apt-get | head -1)")" 1>&4 2>&1
BUILD FAILED (macOS 11.2 using ruby-build 20210119)
Inspect or clean up the working tree at /var/folders/rn/c7nmr3x12gg5r8qwsr4ty8hh0000gn/T/ruby-build.20210210161642.31102.pyKQOf
Results logged to /var/folders/rn/c7nmr3x12gg5r8qwsr4ty8hh0000gn/T/ruby-build.20210210161642.31102.log
Last 10 log lines:
installing bundled gems: /opt/homebrew/opt/rbenv/versions/3.0.0/lib/ruby/gems/3.0.0
minitest 5.14.2
power_assert 1.2.0
rake 13.0.3
test-unit 3.3.7
rexml 3.2.4
rss 0.2.9
rbs 1.0.0
typeprof 0.11.0
installing bundled gem cache: /opt/homebrew/opt/rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/cache |
=> completely uninstall homebrew and starting fresh resolved it for me. |
Thanks! This easy fix worked for me 👍 |
It works 👌🏼 |
Adding libffi worked for me w/ installing ruby-2.6.6. Curiously, I was able to install ruby-3.0.2 first and had no issue. So does 2.6.6 (and others) have some build dependency on libffi? |
I went through many of the above solutions and ended up making a mess of my .zshrc file, and nothing worked. At the end I deleted everything related to this (LD_FLAGS, CPPFLAGS, PKG_CONFIG_FLAGS etc.) from my .zshrc file and simply ran this command:
BINGO! |
I was struggling to install Ruby 2.5.9 on Monterey (12.0.1) and was getting the following error:
But manhcuongdtbk's suggestion above got it working, so thank you! 🍻 |
Hello, jumping on the wagon this is what I'm getting installing ruby 2.7.3 on OSX Monterey with M1 Pro
wasn't able to find any similar case |
@manhcuongdtbk solution worked perfectly for me! Thank you! |
I was having the same problem. M1 chip + Monterey. This is what worked for me:
|
works like a charm! |
Thanks to all for the comments. Been tripped up on this for a couple hours until I stumbled on this thread. Here's what worked for me on a new M1 Max after migration assistant from a 2017 MBP 16"
Rbenv on installing a new version pulled in openssl into its build, which solved the error I had encountered where it said I didn't have openSSL: |
Thanks @goelinsights can you confirm which version of Ruby you were installing? I was still having problems with Ruby 2.2.2 up until very recently so I will give your directions a shot. |
Adding to this already really long thread/issue to contribute with my 2cents 😄 Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
https://docs.brew.sh/Installation The solution was as follows:
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/your-username/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
https://docs.brew.sh Run those 2 commands.
Done! 🎉What Next?Install everything else you think you might need to reinstall (that you saved on step 1). 🙈 Hope this helps! |
My colleague helped me solving this problem with script below: #!/usr/bin/env bash
set -e
# ruby-install --latest
OPENSSL_VERSION=1.1
OPENSSL_DIR=/usr/local/opt/openssl@${OPENSSL_VERSION}
function install-ruby-on-mac() {
PKG_CONFIG_PATH=${OPENSSL_DIR}/lib/pkgconfig \
ruby-install $(ruby-install-options $1) \
ruby $1 \
-- \
--with-openssl-dir=${OPENSSL_DIR} \
--with-opt-dir=$(brew --prefix readline) \
--without-tcl --without-tk
}
install-ruby-on-mac 2.5.8
install-ruby-on-mac 2.6.8
install-ruby-on-mac 2.7.4 Hope it could help someone. |
Actually, a simple |
|
Thanks @andreluizsgf. And did you have to force |
This worked for me to install 2.6.7 on my new Apple M1 MBP |
And @robbyrussell are you using an arm or x86 version of homebrew to install rbenv? |
I figured I'd run into problems compiling Ruby or third-party libraries since I did not use an arm64 shell. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hey there!
I am trying to install Ruby 2.7.2 on my new Apple Silicon Mac but am running into some issues, which I think might be related to
ruby-build
, but not I am not 100%.I have setup an alias on my
~/.zshrc
for Homebrew like this:I have run the following commands in order to install
rbenv
:I have updated my .zshrc file with:
And then I ran the following command:
I have also tried prefixing the
rbenv
command witharch -x86_64
but that did not work either.These are the console logs that I am getting when I am trying to install Ruby:
If you have any ideas for how to make this work, please let me know!
Thanks.
The text was updated successfully, but these errors were encountered: