To install gems we can use the gem command-line program.

Log in to your Hostginger hosting account.

You should be in your home directory. Check your directory using command:

cd

Edit the .bash_profile file in your home directory as 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/local/lib/ruby/gems/2.3.0
export PATH GEM_HOME GEM_PATH

# END

Save the changes to the .bash_profile file.

The modified changes in the .bash_profile file take effect immediately with the following command:
source ~/.bash_profile

Create a directory of your local gems with command:
mkdir -p ~/ruby/gems

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. 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 Hostginger Hosting account username:
gemhome: /usr/local/lib/ruby/gems/2.3.0
gempath: /usr/local/lib/ruby/gems/2.3.0
To check that the gem environment has been updated, type the following command:
gem environment

For installing a gem, type the following command. Replace gemname with the name of the gem that you want to install:
gem install gemname
Was this answer helpful? 0 Users Found This Useful (0 Votes) Ruby, Ruby gems