I installed Ruby with Homebrew:
brew install ruby
Under "Caveats" it said:
NOTE: By default, gem installed binaries will be placed into:
/usr/local/Cellar/ruby/1.9.3-p194/binYou may want to add this to your PATH.
What does that mean and how can I add it to my "path"? Assuming it has to do with a bash_profile but new to this.
On Mac Intel, you'll see /usr/local/ . You can confirm that Homebrew installed Ruby with brew list . You can see a list of the dependencies installed for Ruby with brew deps --tree --installed .
When you use the --user-install option, RubyGems will install the gems to a directory inside your home directory, something like ~/. gem/ruby/1.9.
All versions of Ruby on Mac use Homebrew as the foundation of your development setup. The Basic version installs chruby and ruby-install with Homebrew, then installs the latest version of Ruby. This is the minimum required to work with Ruby.
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.
Add this line to your .profile (or .bash_profile, .bashrc, .zshrc, etc):
export PATH=/usr/local/opt/ruby/bin:$PATH
This is an up-to-date version of Kyle's answer. As of May 2014, brew info ruby
prints:
By default, gem installed executables will be placed into:
/usr/local/opt/ruby/bin
You may want to add this to your PATH. After upgrades, you can run
gem pristine --all --only-executables
...to restore binstubs for installed gems.
Install ruby:
brew install ruby
I'd recommend setting $PATH, $GEM_PATH and $GEM_HOME. For latest Ruby it's:
export PATH=/usr/local/opt/ruby/bin:$PATH
export GEM_HOME=/usr/local/opt/ruby/lib/ruby/gems/2.6.0
export GEM_PATH=/usr/local/opt/ruby/lib/ruby/gems/2.6.0
Put them in something like ~/.bash_profile
.
And then to verify:
type -a ruby
> ruby is /usr/local/opt/ruby/bin/ruby
> ...
ruby -v
> ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
gem list
> *** LOCAL GEMS ***
>
> did_you_mean (1.3.0)
> minitest (5.11.3)
> ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With