3
votes

I'm new to OS X and I'm new to Ruby on Rails.

I just installed Ruby and Rails and when going through my first tutorial here's what I got:

WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and /usr/bin aren't both writable. WARNING: You don't have /Users/sammat/.gem/ruby/1.8/bin in your PATH, gem executables will not run.

Could someone help me rectify this situation?

Cheers!

Sam

3

3 Answers

8
votes

Did this happen when you tried to install a gem? You need to install gems with superuser privileges so you need to use

sudo gem install [gemname]

rather than just

gem install [gemname].
2
votes

Either use sudo to install the gem, such as sudo gem install rails

Or add the locally installed gem path to your general path by editing ~/.bashrc (I hope, I'm a suse user, not really OS X, but should still be there and the same) and adding export PATH=~/.gem/ruby/1.8/bin:$PATH to the bottom of the .bashrc file.

That should do it unless my brain has failed me once again.

2
votes

In OSX you must create the file ~/.bash_login and export the $PATH adding into it:

export PATH="$PATH:/Users/sammat/.gem/ruby/1.8/bin"

You can do this through one command:

echo 'export PATH="$PATH:/Users/sammat/.gem/ruby/1.8/bin"' >> ~/.bash_login