4

I am using some locally installed gems in my environment and I would like to change the EXECUTABLE DIRECTORY path to ~/.gem/bin

How could I achieve this?

$gem env

  - RUBYGEMS VERSION: 2.2.2
  - RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/flyer/.gem/ruby
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /home/flyer/bin
  - SPEC CACHE DIRECTORY: /home/flyer/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/flyer/.gem/ruby
     - /usr/share/gems
     - /usr/local/share/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/local/sbin
     - /usr/bin
     - /usr/sbin
     - /bin
     - /sbin
     - /home/flyer/.local/bin
     - /home/flyer/bin
     - /home/flyer/.local/bin
     - /home/flyer/bin

3 Answers 3

2

If your intention was to install gems' executables into ~/.gem/bin, you can set in ~/.gemrc:

gem:
 --bindir ~/.gem/bin 
 # any other gem settings like: 
 --no-ri --no-rdoc

It will NOT change EXECUTABLE DIRECTORY, but gems' executables will be installed into ~/.gem/bin. You can check it is set by:

$ gem env
- GEM CONFIGURATION:
     - "gem" => "--bindir ~/.gem/bin --no-ri --no-rdoc"

To be able to invoke them, add that directory at the beginning of your PATH.

3

You can try

$ export GEM_HOME = ~/.gem

This will change your gem executable directory into ~/.gem/bin

You can confirm that by run $ gem env again

If that works you can make it permanent by adding export GEM_HOME=$HOME/.gem at the end of file .bashrc or .zshrc

Hope that help!

1

Here is lines for .bashrc / .zshrc:

#Ruby + GEM
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH

After this all my gems start works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .