I have ruby 2.6.8p205 and I installed, 2.5.0
By command
brew install [email protected]
By default, binaries installed by gem will be placed into:
/opt/homebrew/lib/ruby/gems/3.1.0/bin
You may want to add this to your PATH.
ruby is keg-only, which means it was not symlinked into /opt/homebrew, 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="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
For compilers to find ruby you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"
export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"
For pkg-config to find ruby you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/ruby/lib/pkgconfig"
But I run
ruby -v
It still showing
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
Need your help please....
CodePudding user response:
I would advise you to use a ruby version manager like rvm or rbenv, they will make your life so much easier.
To solve the current issue though, can you try brew link [email protected]
and see if that solves the problem.
CodePudding user response:
I would also suggest a ruby version manager, I personally use asdf, if you choose to go with asdf the commands are fairly simple.
To install your desired version -
asdf install ruby <version>
Check to see if you're using that version
ruby -v
If you are not using the correct one
asdf global ruby <version>
Also make sure you're using the ruby in your shims with
which ruby