Cannot install any version of Ruby - M1 Max / Xcode 13.2.1 / Monterey 12.2.1 #1947
-
At some point in time since I got my new M1-Max MBP in February, installing new versions of Ruby has broken. I can't seem to find any info online about this "cannot run C compiled programs" that's not referencing issues solved 5+ years ago. ➜ ~ rbenv install 2.7.5
Downloading openssl-1.1.1l.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
Installing openssl-1.1.1l...
Installed openssl-1.1.1l to /Users/shan/.rbenv/versions/2.7.5
Downloading ruby-2.7.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.5.tar.bz2
Installing ruby-2.7.5...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 12.2.1 using ruby-build 20220218)
Inspect or clean up the working tree at /var/folders/6d/vhw47jn57kj08mhpwcn2ymr80000gn/T/ruby-build.20220303160033.86276.m8tbpl
Results logged to /var/folders/6d/vhw47jn57kj08mhpwcn2ymr80000gn/T/ruby-build.20220303160033.86276.log
Last 10 log lines:
checking host system type... aarch64-apple-darwin21.3.0
checking target system type... aarch64-apple-darwin21.3.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/var/folders/6d/vhw47jn57kj08mhpwcn2ymr80000gn/T/ruby-build.20220303160033.86276.m8tbpl/ruby-2.7.5':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop. I get the same overall error if I try to install 3.0.3. The worst thing about this is that I had previously installed 2.7.5 and everything was working well, but then when I tried to re-install 2.7.5 it broke the existing install. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
No help here, sorry. For what it's worth, I've tried compiling 2.7.5 on a fresh M1 machine and it works out of the box without problems. I do not have access to a M1 Max machine. |
Beta Was this translation helpful? Give feedback.
-
I could install them with the same environment, which is M1 Max, macOS 12.2.1. Maybe you mixed the x86 and aarch64 architecture with Rosetta2. |
Beta Was this translation helpful? Give feedback.
-
I ended up doing the following:
After this, I was able to install Ruby again. No idea what the problem was. |
Beta Was this translation helpful? Give feedback.
-
Try ! Rebooting ! It really helps and can solve the issue ! |
Beta Was this translation helpful? Give feedback.
I ended up doing the following:
brew remove rbenv ruby-build
rm -rf ~/.rbenv
rm -rf ~/Library/Caches/Homebrew
brew update && brew upgrade
After this, I was able to install Ruby again. No idea what the problem was.