Because the current user of your system does not have write permissions to the /Library/Ruby/Gems/2.0.0 directory. You can use sudo gem install rails to gain root permissions to operate. However, this is not recommended. The Ruby you are using now is the Ruby that comes with the system. This is not conducive to upgrading and switching Ruby versions in the future, and it is not very convenient to manage gems. It is recommended that you use a Ruby version management tool such as rvm or rbenv to install and manage your Ruby.
The specific choice of rvm or rbenv depends on your personal preference. I use rvm.
Because the current user of your system does not have write permissions to the /Library/Ruby/Gems/2.0.0 directory. You can use sudo gem install rails to gain root permissions to operate. However, this is not recommended. The Ruby you are using now is the Ruby that comes with the system. This is not conducive to upgrading and switching Ruby versions in the future, and it is not very convenient to manage gems. It is recommended that you use a Ruby version management tool such as rvm or rbenv to install and manage your Ruby.
The specific choice of rvm or rbenv depends on your personal preference. I use rvm.
Rvm Practical Guiderbenv Practical Guide