Home > Software engineering >  Unclear on how to upgrade new version of Ruby
Unclear on how to upgrade new version of Ruby

Time:02-03

See the terminal commands I used below to upgrade to the newest version of Ruby. It says at one point "ruby 3.2.0 is already installed and up to date", but when I run "ruby -v" it still returns the old version of Ruby. Am I doing something wrong?

➜  ~ ruby -v            
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
➜  ~ brew install ruby  
Error: 
homebrew-core is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
Warning: ruby 3.2.0 is already installed and up-to-date.
To reinstall 3.2.0, run:
brew reinstall ruby
➜  ~ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
➜  ~ brew reinstall ruby
==> Fetching ruby
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/manifests/3.2.0
Already downloaded:                    /Users/Madeline/Library/Caches/Homebrew/downloads/c360900acacef49e831b0f640b0e175180c181ef83afbcd24d4d6609fbf146fe--ruby-3.2.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/blobs/sha256:c25553dfc94e9
Already downloaded:     /Users/Madeline/Library/Caches/Homebrew/downloads/f587974e09ec9fbb07b125260da3ce05b66e91a92ec27898f2e446b81a840b88--ruby--3.2.0.monterey.bottle.tar.gz
==> Reinstalling ruby 
==> Pouring ruby--3.2.0.monterey.bottle.tar.gz
==> Caveats
By default, binaries installed by gem will be placed into:
/usr/local/lib/ruby/gems/3.2.0/bin

You may want to add this to your PATH.

ruby is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have ruby first in your PATH, run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc

For compilers to find ruby you may need to set:
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"

For pkg-config to find ruby you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"

==> Summary
           
  • Related