Unable to install ruby 3.1.x on M1 (Apple Silicon) #1961
-
Steps to reproduce the behavior
Expected vs. actual behaviorExpected: Successful installation of ruby 3.1.x
I am using macOS Big Sur 11.6.4 on an M1 MacBook Air.
```
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems -r./arm64-darwin20-fake ./tool/rbinstall.rb --make="make" --dest-dir="" --extout=".ext" --ext-build-dir="./ext" --mflags="" --make-flags="" --data-mo
de=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --gnumake --install=all --rdoc-output=".ext/rdoc" --html-output=".ext/html"
installing binary commands: /Users/milos/.rbenv/versions/3.1.2/bin
installing base libraries: /Users/milos/.rbenv/versions/3.1.2/lib
installing arch files: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/3.1.0/arm64-darwin20
installing pkgconfig data: /Users/milos/.rbenv/versions/3.1.2/lib/pkgconfig
installing extension objects: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/3.1.0/arm64-darwin20
installing extension objects: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/arm64-darwin20
installing extension objects: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/vendor_ruby/3.1.0/arm64-darwin20
installing extension headers: /Users/milos/.rbenv/versions/3.1.2/include/ruby-3.1.0/arm64-darwin20
installing extension scripts: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/3.1.0
installing extension scripts: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0
installing extension scripts: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/vendor_ruby/3.1.0
installing extension headers: /Users/milos/.rbenv/versions/3.1.2/include/ruby-3.1.0/ruby
installing rdoc: /Users/milos/.rbenv/versions/3.1.2/share/ri/3.1.0/system
installing html-docs: /Users/milos/.rbenv/versions/3.1.2/share/doc/ruby
installing capi-docs: /Users/milos/.rbenv/versions/3.1.2/share/doc/ruby
installing command scripts: /Users/milos/.rbenv/versions/3.1.2/bin
installing library scripts: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/3.1.0
installing common headers: /Users/milos/.rbenv/versions/3.1.2/include/ruby-3.1.0
installing manpages: /Users/milos/.rbenv/versions/3.1.2/share/man/man1
installing default gems from lib: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0
abbrev 0.1.0
base64 0.1.1
benchmark 0.2.0
bundler 2.3.7
cgi 0.3.1
csv 3.2.2
delegate 0.2.0
did_you_mean 1.6.1
drb 2.1.0
english 0.7.1
erb 2.2.3
error_highlight 0.3.0
fileutils 1.6.0
find 0.1.1
forwardable 1.3.2
getoptlong 0.1.1
ipaddr 1.2.4
irb 1.4.1
logger 1.5.0
mutex_m 0.1.1
net-http 0.2.0
net-protocol 0.1.2
observer 0.1.1
open-uri 0.2.0
open3 0.1.1
optparse 0.2.0
ostruct 0.5.2
pp 0.3.0
prettyprint 0.1.1
pstore 0.1.1
racc 1.6.0
rdoc 6.4.0
readline 0.0.3
reline 0.3.0
resolv 0.2.1
resolv-replace 0.1.0
rinda 0.1.1
ruby2_keywords 0.0.5
securerandom 0.1.1
set 1.0.2
shellwords 0.1.0
singleton 0.1.1
tempfile 0.1.2
time 0.2.0
timeout 0.2.0
tmpdir 0.1.2
tsort 0.1.0
un 0.2.0
uri 0.11.0
weakref 0.1.1
yaml 0.2.0
installing default gems from ext: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0
bigdecimal 3.1.1
date 3.2.2
digest 3.1.0
etc 1.3.0
fcntl 1.0.1
fiddle 1.1.0
io-console 0.5.11
io-nonblock 0.1.0
io-wait 0.2.1
json 2.6.1
nkf 0.1.1
openssl 3.0.0
pathname 0.2.0
psych 4.0.3
readline-ext 0.1.4
stringio 3.0.1
strscan 3.0.1
syslog 0.1.0
zlib 2.1.1
installing bundled gems: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0
minitest 5.15.0
power_assert 2.0.1
rake 13.0.6
test-unit 3.5.3
rexml 3.2.5
rss 0.2.9
net-ftp 0.1.3
net-imap 0.2.3
net-pop 0.1.1
net-smtp 0.3.1
matrix 0.4.2
prime 0.1.2
rbs 2.1.0
Building native extensions. This could take a while...
/private/var/folders/y5/vfyf5lqj655g_zbm8pvdgmkr0000gn/T/ruby-build.20220419112708.37523.JUSU2F/ruby-3.1.2/lib/rubygems/ext/builder.rb:95:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
/Users/milos/.rbenv/versions/3.1.2/bin/ruby --disable\=gems -I/Users/milos/.rbenv/versions/3.1.2/lib/ruby/3.1.0/arm64-darwin20 -I /private/var/folders/y5/vfyf5lqj655g_zbm8pvdgmkr0000gn/T/ruby-build.20220419112708.37523.JUSU2F/ruby-3.1.2/ current directory: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension current directory: /Users/milos/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension make failed, uncaught signal 6
|
Beta Was this translation helpful? Give feedback.
Replies: 22 comments 34 replies
-
I was able to install 3.1.2 AFTER I installed 3.1.0. But trying to go straight to 3.1.2 failed. |
Beta Was this translation helpful? Give feedback.
-
Same issue here. Macbook Pro 14" M1 on Monterrey. @milosivanovic were you able to find a workaround? Tried rbenv and asdf and I got the same error twice. I have 3.1.0 installed but I am unable to get 3.1.2. The error is
Related: #1930 |
Beta Was this translation helpful? Give feedback.
-
It's really weird, I tried on a new 16-inch M1 Max on Monterey 12.3.1, and I had no issues installing 3.1.0 or 3.1.2, but on the M1 MacBook Air on Big Sur I continue to be unable to install any 3.1.x version. It doesn't appear to be an OS-specific issue since you are also encountering this on Monterey (albeit just with 3.1.2.) It really makes me wonder what could be causing the incompatibility. |
Beta Was this translation helpful? Give feedback.
-
I am getting
|
Beta Was this translation helpful? Give feedback.
-
Any update on this issue guys? |
Beta Was this translation helpful? Give feedback.
-
If it helps anyone: I ended up getting RVM, installing 3.1.0, and then was able to install 3.1.x using rbenv/ruby-build. I was then able to uninstall RVM. In my case, I was having issues with Psych and possible incompatibility between 2.7.x and 3.x. Your mileage may vary! |
Beta Was this translation helpful? Give feedback.
-
if you already have install brew and rbenv, first update ruby-build:
after this you should be able to install ruby version 3.1.2 |
Beta Was this translation helpful? Give feedback.
-
I'm stuck not being able to install 3.1.0 or 3.1.2. I've been using I'm not too familiar with the tooling, but is there a way that I can debug further which part of the build process this relates to:
The dyld load error kind of makes sense to me because Apple compiled binaries use the arm64e arch whereas things that are compiled by the user are using arm64. My stab in the dark is that something Apple compiled its trying to load libruby.3.1.dylib on our machines but not for other people? In one of the other threads, the theory was that its was |
Beta Was this translation helpful? Give feedback.
-
I had success installing |
Beta Was this translation helpful? Give feedback.
-
You can just upgrade your ruby-build, by running the following command:
And then you can download the correct version. :) |
Beta Was this translation helpful? Give feedback.
-
I had the same problem and none of the solutions mentioned above could solve it. I experimented with the new Silicon homebrew and I saw that That helped! So now it works. |
Beta Was this translation helpful? Give feedback.
-
I have one of the problems stated here:
And none of the solutions documented worked for me. I still have no way to install any Ruby I have tried the next:
I'm not an expert by any means, but I'm wondering if this is specific for My tools:
|
Beta Was this translation helpful? Give feedback.
-
@liamnichols thanks for figuring out a way to build from source while still making it compatible with rbenv. Your solution worked great for me. I agree the issue thus appears to be with ruby-build so I opened another bug with those findings: #2073 For the record, the workaround is as follows:
Then it will show up in the
|
Beta Was this translation helpful? Give feedback.
-
Update: Ruby 3.1.3 is out which includes fixes for macOS Ventura and Xcode 14: https://github.com/rbenv/ruby-build/releases/tag/v20221124
If that fails, you can try the solutions below: Summarizing the information from different subthreads: if you are affected by build failures on an Apple Silicon machine such as
If possible, avoid nuclear options such as reformatting your entire computer to work around this. Thanks @milosivanovic @liamnichols @gabrielrotbart @JorgeGarciaxyz @hsbt and others who have reported their experiences in detail. 🙇 |
Beta Was this translation helpful? Give feedback.
-
Yesterday I tried to install 3.2.0-preview3. I actually managed to install it. Unfortunately, it crashed while installing gem nokogiri (needed for rails). I tried to use already installed 3.0.4. to insatll nokogiri and rails, but also failed. The reinstall of ruby 3.0.4 failed, too. However, I could install ruby 3.0.5 followed by nokogiri (and rails). Next I tried 3.1.2, which failed, But then I followed the advice of this ticket and installed 3.1.3 with no problems (then nokogiri and rails also without problems). As 3.0.5 and 3.1.3+ rails 7 are ok, 3.2.0 has problems with nokogiri - I will raise ticket there. |
Beta Was this translation helpful? Give feedback.
-
I want to also share a solution to the problem I had installing 3.1.3 via homebrew on MacOS Ventura. https://stackoverflow.com/a/24902917 brew unlink libyaml && brew link libyaml rbenv install 3.1.3 Amongst the fumbling of install/uninstall/reinstall trying to get 3.1.2 working, it appears a symlink gets broken and has to be recreated for 3.1.3 to install successfully. This happened to me on 2 Macbooks with M1. |
Beta Was this translation helpful? Give feedback.
-
I have the same issue when installing ruby via asdf-ruby (as I understand, it uses ruby-build under the hood). What's weird is that I'm installing 3.1.3 which should have a fix for that? |
Beta Was this translation helpful? Give feedback.
-
I tried installing 3.1.3, but here's the error I get...
|
Beta Was this translation helpful? Give feedback.
-
In case someone else faces this error when installing with rbenv: |
Beta Was this translation helpful? Give feedback.
-
Feb 2023, "brew install libyml" along with a basic homebrew setup worked for me. Although that was after reinstalling Ventura on a clean OS install. Previously the MacOS state from upgrading Monterey to Ventura; just doing the brew install libyml did not work because of an SSL lib problem. I wasn't able to get flags to work either, but I had made changes to my ruby and system environments to get an older version of ruby to work from previous (last year) M1 compatibility problem. A reinstall simply took less time, the M1 is pretty fast. AKA: my previous Rube Goldberg for ruby 3.0.4 does not work with the now non-Rube Goldberg ruby 3.1.2. :) |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
I had this issue while my corporate-managed M1 Max was held back to macOS Monterey 12.6.3 with Xcode 14. I was just allowed to upgrade to 12.6.5, and now I'm able to install Ruby without issue or special flags. |
Beta Was this translation helpful? Give feedback.
Update: Ruby 3.1.3 is out which includes fixes for macOS Ventura and Xcode 14: https://github.com/rbenv/ruby-build/releases/tag/v20221124
If that fails, you can try the solutions below:
Summarizing the information from different subthreads: if you are affected by build failures on an Apple Silicon machine such as
dyld: could not load inserted library
orincompatible architecture (have 'arm64', need 'arm64e')
, here is what you can try:Check your Xcode Command Line Tools version:
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
If you are on version 14, try downgrading using these instructions: https://bugs.ruby-lang.org/issues/18912
Disable bui…