Solution worked for Mac Big Sur OS
NOTE : replace user_name - with your laptop user name
-
Check the version of Ruby
ruby -v
Also check the given path:
which ruby
-
Use Homebrew to install the latest Ruby
brew install ruby
Binaries installed by gem will be placed into:
/usr/local/lib/ruby/gems/2.7.0/bin
- Add this to your PATH.
If you need to have ruby first in your PATH run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> /Users/user_name/.bash_profile
- 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"
- Follow the below instructions to set PATH. Now you will go to see the installed Ruby.
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> /Users/user_name/.bash_profile
echo 'export LDFLAGS="-L/usr/local/opt/ruby/lib"' >> ~/.bash_profile
echo 'export CPPFLAGS="-I/usr/local/opt/ruby/include"' >> ~/.bash_profile
source ~/.bash_profile
- Finally, Make sure your PATH is in place.
ruby -v
which ruby
- Make sure you install by specifying the save destination as follows.
sudo gem install -n /usr/local/bin cocoapods
Top comments (1)
Work for me