I have been trying to install ruby 3.1.2 using rbenv install
on my MacBook Air (13-inch, 2017) with processor 2.2 GHz Dual-Core Intel Core i7. I know that it is getting long in the tooth because I'm running macOS 12.6.8 without the option to upgrade to Ventura.
Is there a way to upgrade ruby without upgrading my hardware or should I wait for a new MacBook Air?
I'm running Homebrew 4.1.9, brew update
tells me that it is already up-to-date, and brew doctor
reports that my system is ready to brew.
Here is the environment: RUBY_CONFIGURE_OPTS=--disable-install-doc --with-openssl-dir=/usr/local/opt/openssl@3
Based on https://github.com/rbenv/ruby-build/discussions/1979, I added disable-install-doc and based on https://github.com/rbenv/ruby-build/wiki#macos, I added with-openssl-dir
Here is the start of my installation:
$ 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
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew
After some time, I see this on the terminal:
BUILD FAILED (macOS 12.6.8 using ruby-build 20230904)
Inspect or clean up the working tree at /var/folders/3p/0h3xd1ms06l49ntn60nk0zfr0000gn/T/ruby-build.20230905122044.5742.SGYtEq
Results logged to /var/folders/3p/0h3xd1ms06l49ntn60nk0zfr0000gn/T/ruby-build.20230905122044.5742.log
Last 10 log lines:
from /private/var/folders/3p/0h3xd1ms06l49ntn60nk0zfr0000gn/T/ruby-build.20230905122044.5742.SGYtEq/ruby-3.1.2/lib/fileutils.rb:219:in `block in mkdir_p'
from /private/var/folders/3p/0h3xd1ms06l49ntn60nk0zfr0000gn/T/ruby-build.20230905122044.5742.SGYtEq/ruby-3.1.2/lib/fileutils.rb:211:in `each'
from /private/var/folders/3p/0h3xd1ms06l49ntn60nk0zfr0000gn/T/ruby-build.20230905122044.5742.SGYtEq/ruby-3.1.2/lib/fileutils.rb:211:in `mkdir_p'
from ./tool/rbinstall.rb:218:in `makedirs'
from ./tool/rbinstall.rb:331:in `prepare'
from ./tool/rbinstall.rb:432:in `block in <main>'
from ./tool/rbinstall.rb:1127:in `block in <main>'
from ./tool/rbinstall.rb:1124:in `each'
from ./tool/rbinstall.rb:1124:in `<main>'
make: *** [do-install-nodoc] Error 1
The error in the log file appears as (I've copied a few preceding lines for some context):
installing extension objects: /Users/hepting/.rbenv/versions/3.1.2/lib/ruby/3.1.0/x86_64-darwin21
installing extension objects: /Users/hepting/.rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0/x86_64-darwin21
installing extension objects: /Users/hepting/.rbenv/versions/3.1.2/lib/ruby/vendor_ruby/3.1.0/x86_64-darwin21
installing extension headers:
Users/hepting/.rbenv/versions/3.1.2/include/ruby-3.1.0/x86_64-darwin21
/private/var/folders/3p/0h3xd1ms06l49ntn60nk0zfr0000gn/T/ruby-build.20230905122044.5742.SGYtEq/ruby-3.1.2/lib/fileutils.rb:240:in `mkdir': Permission denied @ dir_s_mkdir - /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users (Errno::EACCES)
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/
does not have a Users
directory. MacOSX.sdk was originally pointing to MacOSX13.sdk -> MacOSX13.1.sdk
but I changed it to point to MacOSX12.sdk -> MacOSX12.3.sdk
Here is a listing of the MacOSX.sdk directory:
$ ls MacOSX.sdk
Entitlements.plist SDKSettings.plist usr
SDKSettings.json System
Is there any way to change that /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users
directory that seems to be at the root of my issue?