- Sounds like you want the command export for setting environment variables:
export PATH=$PATH':/path/to/add'
export GEM_HOME=$HOME/.gem
export GEM_PATH=$HOME/.gem
- That will only take effect for the current session, though. To make them more permanent, add those lines to your ~/.bashrc.
[[https://wiki.archlinux.org/index.php/Ruby]]
- Before you use RubyGems, you should add $(ruby -e "print Gem.user_dir")/bin to your $PATH. You can do this by adding the following line to ~/.bashrc:
PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"
-
This is required for executable gems to work without typing out the full location, although libraries will work without having to modify your path.
-
If the method above does not work, you can try adding these lines at the end of your shell configuration file instead:
#Setting the GEM_PATH and GEM_HOME variables may not be necessary, check 'gem env' output to verify whether both variables already exist
GEM_HOME=$(ls -t -U | ruby -e 'puts Gem.user_dir')
GEM_PATH=$GEM_HOME
export PATH=$PATH:$GEM_HOME/bin
-
Note: This can be made the default option by configuring the following ~/.gemrc file:
-
Installing gems per-user or system-wide
- By default in Arch Linux, when running gem, gems are installed per-user (into ~/.gem/ruby/), instead of system-wide (into /usr/lib/ruby/gems/). This is considered the best way to manage gems on Arch, because otherwise they might interfere with gems installed by Pacman.
- Gems can be installed system wide by running the gem command as root, appended with the --no-user-install flag. This flag can be set as default by replacing --user-install by --no-user-install in /etc/gemrc (system-wide) or ~/.gemrc (per-user, overrides system-wide).
- Bundler solves these problems to some extent by packaging gems into your application. See the section below on using bundler.
export GEM_HOME=$(ruby -e 'print Gem.user_dir')
- Quarry is an opensource tool (GPL3 license) that allows to maintain rubygems binary repository for Arch Linux, as an easier alternative to building packages manually from the AUR. The source is hosted at github
[[http://stackoverflow.com/questions/26560725/bundler-setup-loaderror/26560950#26560950]]
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23.2
- RUBY VERSION: 1.9.3 (2014-05-14 patchlevel 547) [x86_64-darwin13.3.0]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /Users/me/.rbenv/versions/1.9.3-p547/bin/ruby
- EXECUTABLE DIRECTORY: /usr/lib/ruby/gems/2.0.0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-13
- GEM PATHS:
- /usr/lib/ruby/gems/2.0.0
- /Users/me/.gem/ruby/1.9.1
- /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES: