gem install rails ERROR

Hi, I am new in mac and ruby on rails, please bear with me if I asked
stupid questions :

I tried to install, rails in my mac :"

bdelmajids-iMac:~ majid$ gem install rails
ERROR: While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/1.8
directory.
Abdelmajids-iMac:~ majid$

Please your help is appreciated.
thanks,

From the looks of it, you're trying to install rails system-wide with
that. If that's what you want, preceed the gem command with sudo.

A possibly better alternative is to install either rvm or rbenv, and
have things loaded per user or per project.

The samething happened when I try :
sudo gem install rails

I have rvm installed, how should I use it ?
thanks

gem install rails --version=4.0.0.rc1

version what ever you want

have you tried http://ryanbigg.com/2011/06/mac-os-x-ruby-rvm-rails-and-you/

This should help:
http://railsapps.github.io/installing-rails.html