Rails without sudo
The installation process is an unfortunate stumbling block for many people learning Ruby on Rails. While it is easy to get going, it is also too easy to end up using sudo
to install various things as root along the way. I remember this being annoying for me 7 years ago, and revisiting the framework today, it does not seem like much had changed. Hopefully these steps will help!
- Follow the installation instructions for
rbenv
- Before installing bundler or rails, run
rbenv global <version>
where<version>
is the latest stable version of Ruby, andrbenv rehash
to make sure it is being used. - Now when you run
gem install rails
andrails new
you should not be prompted to run any commands usingsudo
.