Although some system package managers on Linux or Unix provides Ruby gems as package, you still want to
gem to install updated or specific gems sometimes. One popular way is using RVM, a command-line tool which allow you to manage multiple Ruby environment. Nevertheless, if you do not need multiple Ruby versions in one system, you may also choose to install Ruby gems to local directories like home directory. By this way, gems files will not be mixed with other system files.
To install gems locally, set ~/.gemrc. Before that, type
gem environment in terminal to get some information about gem environment. What you need is GEM PATHS.
Edit ~/.gemrc. Set gemhome and gempath variable with your own values. Personally, I prefer to store all library files in ~/lib. You may set to other path. Remember to set with absolute path because ~/.gemrc is not a shell script file.
Set GEM_HOME, GEM_PATH and PATH variable in ~/.profile or ~/.bash_profile to use executives.
Finally, you can install gems in home directory and enjoy Ruby programming.