I'm trying to install Ruby for programming on my macOS Monterey with Apple M1 chip.
I started off by following these steps:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Ok, great! That works...
brew install rbenv
This also worked. I double checked and got: rbenv 1.2.0 is already installed and up-to-date.
rbenv init
This outputs this: eval "$(rbenv init - zsh)"
so I change it to that, close terminal, and relaunch it.
rbenv install 3.0.4
And this gets this:
ME@0107 ~ % rbenv install 3.0.4
Downloading openssl-1.1.1q.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca
Installing openssl-1.1.1q...
patching file test/v3ext.c
Installed openssl-1.1.1q to /Users/ME/.rbenv/versions/3.0.4
Downloading ruby-3.0.4.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.4.tar.gz
Installing ruby-3.0.4...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 12.5 using ruby-build 20220726)
Inspect or clean up the working tree at /var/folders/bn/gcvl_htn4lz2y2d9h215n0vc0000gn/T/ruby-build.20220814230938.91093.ruEkdU
Results logged to /var/folders/bn/gcvl_htn4lz2y2d9h215n0vc0000gn/T/ruby-build.20220814230938.91093.log
Last 10 log lines:
The Ruby yaml extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/ME/.rbenv/versions/3.0.4
--with-openssl-dir=/Users/ME/.rbenv/versions/3.0.4/openssl
--enable-shared
--with-readline-dir=/opt/homebrew/opt/readline
CC=clang
LDFLAGS=-L/Users/ME/.rbenv/versions/3.0.4/lib
CPPFLAGS=-I/Users/ME/.rbenv/versions/3.0.4/include
ME@0107 ~ %
Here's where it gets crazy:
I type in: rbenv global 3.1.2
No output... If I typed anything else, terminal would say:
rbenv: version `3.0.2' not installed
but then I type... ruby -v
And I get...
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin18]
Any help would be greatly appreciated.