I\'m trying to install Rails 3 on a brand new MacBook Pro running OS X 10.6.3, Ruby 1.8.7, and Rails 2.3.5 and I\'m wondering if I\'ve hosed myself. So far, I\'ve run these
To fix your specific error you need to run that command as sudo, ie:
sudo gem install rails --pre
I'd suggest using RVM it allows you have multiple versions of Ruby/Rails installed with gem profiles and basically keep all your gems contained from one another. You may want to check out a similar post How can I install Ruby on Rails 3 on OSX
Using the -n /usr/local/bin flag does work, BUT I had to come back to this page every time I wanted to update a package again. So I figured out a permanent fix for this.
For those interested in fixing this permanently:
Create a ~/.gemrc file
vim .gemrc
With the following content:
:gemdir:
- ~/.gem/ruby
install: -n /usr/local/bin
Now you can run your command normally without the -n flag.
Enjoy!