How to install and manage Ruby Gems

1 de noviembre, 2015 @ 00:45 — 0 comentarios

The installation and management of Ruby Gems is pretty easy. By default any gem you may install will be installed on the ruby/gems folder of your hosting account.

Some considerations

  • Gems are managed from the command line so you have to use SSH.
  • Some gems requiere compilation, so enable compilers.
  • Some gems have special requirements that may require installation of third party libraries.
  • Read the recommendations to avoid Gem hell

How to install a Gem

Gems are installed from the command line and many of them requiere compilation, so before installing a gem you should enable compilers and then access your hosting account using SSH.

In order to install a gem just execute from the command line:

gem install [gem name]

Note: You must replace [gem name] with the real name of the gem.

You can also specify the exact version you want to install, for examploe:

gem install mysql2 -v 0.4.0

How to view installed gems

Just access your account using SSH and execute:

gem list

Errors on Gem installation

Most errors are related to not having access to compilers, so make sure you have enabled compilers from the Hosting Panel, then access the account using SSH and verify you have access to compilers running:

gcc -v

If you get the following error, for some reason you don't have access to compilers:

-jailshell: /usr/bin/gcc: Permission denied

If you can't install a gem contact us and we'll help you.

Etiquetas: