How do I fix the "You don't have write permissions into the /usr/bin directory" error when installing Rails?

ruby-on-rails-3

Solution

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

Problem

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 commands: ``` $ gem update --system $ gem install arel tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n $ gem install rails --pre ``` However, when I run the last command, I get this error: ``` ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /usr/bin directory. ``` I think it wants me to run the command with `sudo` so that it can write over `/usr/bin/rails`. But if I do that, won't I be overwriting my Rails 2.3.5 executable? I don't want to do that. Instead, I'd like to keep both versions of Rails. How do I do that?

Original source

Related problems