Specific Gems can be installed on your server without needing sudo/admin rights. The gem command offers a specific flag, '--user-install', which allows you to install a gem within your local directory.
Getting Started with User Installed Gems
Step 1: Export Gems Path.
- Export Gems to your PATH by running these two commands within your terminal.
export GEM_HOME=$HOME/.gem export PATH=$GEM_HOME/bin:$PATH
Step 2: Download your whichever Gem you desire by using the following command.
- Notice how the command does not have sudo. Be sure to replace the place holder, [gem_name], with the Gem you want to have installed. Make sure to have the --user-install flag at the end of the command as well. Example: gem install cocoapods --user-install
gem install [gem_name] --user-install
As simple as that, your Gem environment is equipped to install whatever Gem you want. If you want to see where any Gem is installed, you may do so by typing the following command.
gem which [gem_name]