Homebrew Install Ruby Keg-Only Can't Find Gem

Installing Ruby with Homebrew

in ~/.bash_profile add the following line

export PATH=/usr/local/Cellar/ruby/1.9.3-p194/bin:$PATH

When you're done, close your terminal and re-open it. You should be fine.

Alternatively, you can execute the follwing in each open shell instead of closing/re-opening:

source ~/.bash_profile

Note:
I highly recommend installing ruby via rvm or rbenv so you can manage multiple ruby versions and use gemsets.

trouble upgrading ruby 2.6 on my MacOS 10.15.7

The best way to use ruby on mac is to use ruby version manager. I use rbenv. It allows you easly to switch between different ruby versions and doesn't cause conflicts.

To install it run brew install rbenv ruby-build

then echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

and finally source ~/.bash_profile

now install any ruby for example 3.0.0 by typing rbenv install 3.0.0
and set it globally
rbenv global 3.0.0

edit: This may not work if you're using different shell. Check what shell is your default by running echo $SHELL

If your default shell is zsh, then instead of your second and third steps run:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc

echo 'eval "$(rbenv init -)"' >> ~/.zshrc

source ~/.zshrc

gem install - fatal error: 'ruby/config.h' file not found in Mojave

If you have the Xcode 10 beta running this might fix it

sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer


Related Topics



Leave a reply



Submit