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:
- Log in to your account using SSH.
- Make sure you are in your home directory:
cd ~- Open the .bash_profile file in your home directory and ensure it contains the following:
# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi
# Set paths for Ruby gems:PATH=$HOME/ruby/gems/bin:$PATHGEM_HOME=$HOME/rubyGEM_PATH=$HOME/ruby/gems:/usr/lib/ruby/gems/1.8export PATH GEM_HOME GEM_PATH- Save the file.
- Apply the settings immediately:
source ~/.bash_profile- Create a directory for your local gems:
mkdir -p ~/ruby/gems- Create a .gemrc file in your home directory. Replace username with your ruachost.com account username:
gemhome: /home/username/ruby/gemsgempath:- /home/username/ruby/gems- /usr/lib/ruby/gems/1.8- Verify the environment settings:
Bash
gem environment
- Install a gem:
gem install gemnameExample:
gem install sass- Uninstall a gem:
gem uninstall gemname