asdf-ruby: Installing Ruby 2.6 on macOS 12.6 Fails
Alternate title: Installing Ruby 2.6, when Xcode 14 is Installed, Fails
(If you’re having problems with Ruby 2.7 or Ruby 3, you might try these env variables)
Updated to macOS 12.6 and Ruby 2.6.5, 2.6.6, 2.6.9, and 2.6.10 no longer install.
Someone’s gonna find a better solution (thank you in advance!), but this works for now:
- Remove Xcode (version 14):
sudo rm -rf /Library/Developer/CommandLineTools
- Go to Xcode’s download page: https://developer.apple.com/download/all/?q=Xcode
- Create an account if necessary
- Download Xcode 13.4.1
- Install Xcode
- Tell your terminal where Xcode lives now: (Mine ended up in my Downloads folder)
In a terminal tab,
sudo xcode-select --switch "$HOME/Downloads/Xcode.app"
(but replace that path with the correct one for you) - Install Ruby with these flags
What kinds of errors was I seeing:
BUILD FAILED (macOS 12.6 using ruby-build 20220630)
Inspect or clean up the working tree at /var/folders/4y/df7znl5n0nx_39q3rpr9dfmc0000gq/T/ruby-build.20220914224941.69763.pnUSK4
Results logged to /var/folders/4y/df7znl5n0nx_39q3rpr9dfmc0000gq/T/ruby-build.20220914224941.69763.log
Last 10 log lines:
transform_mjit_header: SKIPPED to transform __inline_isfinitel
transform_mjit_header: SKIPPED to transform __inline_isfinited
transform_mjit_header: SKIPPED to transform __inline_isfinitef
transform_mjit_header: SKIPPED to transform __darwin_fd_clr
transform_mjit_header: SKIPPED to transform __darwin_fd_set
transform_mjit_header: SKIPPED to transform __darwin_fd_isset
transform_mjit_header: SKIPPED to transform __darwin_check_fd_set
transform_mjit_header: SKIPPED to transform __sputc
transdb.h updated
ln -sf ../../../.ext/include/-darwin21/rb_mjit_min_header-2.6.6.h include/ruby-2.6.0/-darwin21/rb_mjit_min_header-2.6.6.h
linking shared-library libruby.2.6.dylib
Undefined symbols for architecture arm64:
"__mh_execute_header", referenced from:
_rb_dump_backtrace_with_lines in addr2line.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libruby.2.6.dylib] Error 1
make: *** Waiting for unfinished jobs....
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 30
- Comments: 16 (1 by maintainers)
@leminh0796 thanks! @jaydorsey Can confirm I also got it working without rosetta. I initially misread step 4 as installing XCode CLT v13.x which no longer works on Ventura. Manually unpacking Xcode 13 however and using
xcode-select
to point at that version as in the above instructions does the trick tho.These are the steps I followed for Ventura:
Remove Xcode (version 14): sudo rm -rf /Library/Developer/CommandLineToolsoptflags=-Wno-error=implicit-function-declaration ASDF_RUBY_BUILD_VERSION=v20220630 asdf install ruby SOME_VERSION
I get exactly the same error, on macOS 12.6 , Pro M1.
Thank you for posting the issue.
Running this worked for me in Ventura (13.2):
for rbenv users do this
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --switch "$HOME/Downloads/Xcode.app"
(but replace that path with the correct one for you)optflags=-Wno-error=implicit-function-declaration rbenv install [version]
I just spent 4h trying pretty much everything on the internet, your solution is the only one that worked for me!
Thank you so much @lokulin !!
The command from @lokulin’s instructions worked for me (on macOS Sonoma 14.3 with xcode CL tools 15.1) without having to download an older Xcode or switch CL tools:
A workaround I found is the following:
I added more context in this stackoverflow post. I wonder if it would be worth documenting out of band installs on the readme for scenarios like this? It’s fairly edge case, but I suspect a number of folks will continue to run into this over the next year or two, and not everyone will have the option to “just upgrade”.
For me, it hasn’t worked. I installed ruby version 2.7.6
solved it with reinstall command line tool 13.4, thanks for your help