> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installing Ruby Gems

> Install Ruby gems easily with our guide, complete with code and related article links.

This article describes how to install Ruby gems on your account.

<Warning>
  **Important**

  The information in this article only applies to accounts that do **not** have the Ruby Selector in cPanel. In the **Software** section of the cPanel home screen, check for the **Setup Ruby App** icon. If the icon is present, please read [this article](/docs/setting-up-multiple-versions-of-ruby) instead.
</Warning>

## Installing Ruby gems

You can install gems using the *gem* command-line program. To do this, follow these steps:

1. Log in to your account [using SSH](/docs/using-ssh-secure-shell).

2. To make sure you are in your home directory, type the following command at the command line:

   ```bash theme={null}
   cd ~
   ```

3. Use your preferred text editor to edit the *.bash\_profile* file in your home directory. The *.bash\_profile* file should contain the following configuration:

   ```
   #.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
   ```

4. Save your changes to the *.bash\_profile* file.

5. To make the settings in the *.bash\_profile* file take effect immediately, type the following command:

   ```bash theme={null}
   source ~/.bash_profile
   ```

6. To create a directory for your local gems, type the following command:

   ```bash theme={null}
   mkdir -p ~/ruby/gems
   ```

7. Use your preferred text editor to create a *.gemrc* file in your home directory. The *.gemrc* file sets the **GEM\_PATH** and **GEM\_HOME** variables that are used by the *gem* program. The *gemhome* value is set to the full path where the gems will be installed (this is the directory that you created in step 6). The *gempath* values are set to the *gemhome* directory, as well as to the system-wide base gems directory. The following text shows an example *.gemrc* file. Replace ***username*** with your own hosting.com account username:

   ```
   gemhome: /home/username/ruby/gems
   gempath:
   - /home/username/ruby/gems
   - /usr/lib/ruby/gems/1.8
   ```

8. To verify that the gem environment has been updated, type the following command:

   ```bash theme={null}
   gem environment
   ```

   The output should display **GEM PATHS** with the values that you set in the *.gemrc* file.

9. To install a gem, type the following command. Replace ***gemname*** with the name of the gem that you want to install:

   ```bash theme={null}
   gem install gemname
   ```

   For example, to install the sass gem, type `gem install sass`.

   > 👍 Tip
   >
   > To uninstall a gem, type the following command:
   >
   > ```bash theme={null}
   > gem uninstall gemname
   > ```

## Related articles

* [Using the Interactive Ruby Shell to troubleshoot gems](/docs/using-the-interactive-ruby-shell-to-troubleshoot-gems)
