If you don't want to run sudo
then install ruby using homebrew
brew install ruby
export GEM_HOME="$HOME/.gem"
gem install rails
You may want to add export GEM_HOME="$HOME/.gem"
to your ~/.bash_profile
or .zshrc
if you're using zsh
Note: RubyGems keeps old versions of gems, so feel free to do some cleaning after updating:
gem cleanup