How to install ruby gems without sudo

I want to install a Ruby Gem to my computer, but since I don't have an administrator account I can't use sudo. How do I install a Gem without sudo, and what (if any) privileges do I loose? This is in reference to this question I asked on Stack Overflow.

Update:

I installed RVM, but I got these two errors:

WARNING: your RVM loading script `/etc/profile.d/rvm.sh` is deprecated
and causes you to have `umask g+w` set in your shell,
run `rvm get head --auto-dotfiles` again to fix your scripts.

And

WARNING: You have '~/.profile' file, you might want to load it,
to do that add the following line to '/Users/CalebKleveter/.bash_profile':

  source ~/.profile

I ran rvm get head --auto-dotfiles, but I got the same errors again. Any suggestions on what to do? And what does the second error message want me to do?

Update 2:

I tried gem install cocoapods and I got the error in my other post, then I tried rvm gem install cocoapods and I got "Please note that rvm gem ... was removed, try gem install cocoapods or rvm all do gem install cocoapods instead. ( see: 'rvm usage' )" so I tried rvm all do gem install cocoapods and it just started a new command prompt, that is what is supposed to happen, right?


Solution 1:

RVM:

From the rvm.io homepage, I used: \curl -sSL https://get.rvm.io | bash -s stable . This worked fine for me, no admin permissions needed.

Solution 2:

I want to install a Ruby Gem to my computer, but since I don't have an administrator account I can't use sudo. How do I install a Gem without sudo, and what (if any) privileges do I loose?

Yes, use the --user-install flag, which will install gems into your local directory.

gem install jekyll --user-install

This will make them only accessible to you, not to other users on the machine. You may need to add the bin directory into your PATH; if so, gem install will tell you.