Truly I don't get it what is wrong. I've got fresh project with Rails 7 and Ruby 3.1.2 which I thought I had installed successfully, based on my iTerm2 console:
$ ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
But after firing up the command spring stop
inside my project path I'm getting this weirdo:
➜ merchant-portal git:(main)$ spring stop
rbenv: version `ruby-3.1.2' is not installed (set by /Users/some_user/merchant-portal/.ruby-version)
What's going on?
I tried installing the Ruby 3.1.2 again but I'm getting another weirdo:
$ rbenv install 3.1.2
Downloading ruby-3.1.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.2.tar.gz
Installing ruby-3.1.2...
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/bw/rs138g1n5zv_qwn7_7kggc9r0000gq/T/ruby-build.20220801173008.20865.CTLYIi
Results logged to /var/folders/bw/rs138g1n5zv_qwn7_7kggc9r0000gq/T/ruby-build.20220801173008.20865.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/some_user/.rbenv/versions/3.1.2
--with-openssl-dir=/Users/some_user/.rbenv/versions/3.1.2/openssl
--enable-shared
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/some_user/.rbenv/versions/3.1.2/lib
CPPFLAGS=-I/Users/some_user/.rbenv/versions/3.1.2/include
I've tried to reinstall xcode
with:
$ rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
(...)
Done
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
And again reinstall Ruby 3.1.2 but it shows me the same error:
$ rbenv install 3.1.2
(...)
BUILD FAILED (macOS 12.5 using ruby-build 20220726)
(...)
Last 10 log lines:
The Ruby yaml extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
(...)
I've also tried to:
RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline` --with-libyaml-dir=`brew --prefix libyaml`" rbenv install 3.1.2
But it shows me the same error.