Skip to content

Installing Ruby Gems

Installing Ruby Gems
Learn how to install Ruby gems on your account with this detailed guide.

Installing Ruby gems
Follow these steps to install gems using the gem command-line tool:

  1. Log in to your account using SSH.
  2. Make sure you are in your home directory:
Terminal window
cd ~
  1. Open the .bash_profile file in your home directory and ensure it contains the following:
.bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# Set paths for Ruby gems:
PATH=$HOME/ruby/gems/bin:$PATH
GEM_HOME=$HOME/ruby
GEM_PATH=$HOME/ruby/gems:/usr/lib/ruby/gems/1.8
export PATH GEM_HOME GEM_PATH
  1. Save the file.
  2. Apply the settings immediately:
Terminal window
source ~/.bash_profile
  1. Create a directory for your local gems:
Terminal window
mkdir -p ~/ruby/gems
  1. Create a .gemrc file in your home directory. Replace username with your ruachost.com account username:
gemhome: /home/username/ruby/gems
gempath:
- /home/username/ruby/gems
- /usr/lib/ruby/gems/1.8
  1. Verify the environment settings:

Bash
gem environment

  1. Install a gem:
Terminal window
gem install gemname

Example:

gem install sass
  1. Uninstall a gem:
Terminal window
gem uninstall gemname