Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install gem in local folder

Tags:

linux

ruby

gem

I have limited privileges on a shared machine I'm using, so I can't install gems the way I'm used to. For example:

$ gem install request-log-analyzer ERROR:  While executing gem ... (Gem::FilePermissionError)     You don't have write permissions into the /usr/lib/ruby/gems/1.8 directory.  

Is it possible to install a gem locally? (if it matters, I'm trying to install this gem.)

I saw a number of posts on Stack Overflow that talked about using Bundler or gemfiles but I'm not installing this gem for a Ruby on Rails project - I just want to use it in isolation.

I'm running Linux, not sure which flavor though.

like image 242
m81 Avatar asked Jul 23 '15 19:07

m81


People also ask

Where does gem install?

All of your installed gem code will be there, under the gems directory. These paths vary from system to system, and they also depend on how you installed Ruby (rvm is different from Homebrew, which is different from rbenv, and so on). So gem environment will be helpful when you want to know where your gems' code lives.

How do I install a gem file?

run the command bundle install in your shell, once you have your Gemfile created. This command will look your Gemfile and install the relevant Gems on the indicated versions. The Gemfiles are installed because in your Gemfile you are pointing out the source where the gems can be downloaded from.


1 Answers

You can try:

gem install --user-install gem_name 
like image 143
Tho Nguyen Avatar answered Sep 25 '22 01:09

Tho Nguyen