<Rubygems> How to Change Gem Environment Settings

RubyGems How to change gem environment settings?

Actually I searched online and found the solution.

Just put the following in your .profile (Max OS) or .bashrc (Linux)

export GEM_PATH=/Users/myusername/Tools/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
export GEM_SPEC_CACHE=/Users/myusername/Tools/.rbenv/versions/2.1.0/lib/ruby/gems/specs

Make sure the folder you put there existed. Then source the .profile or .bashrc, or simply restart your terminal. It is tested working now my env is correct.

Reference:
https://github.com/rubygems/rubygems/pull/489

How to set correct Ruby version in gem environment

My missing step was installing RubyGems 1.6.2 from source. Following advice elsewhere from Dan Cheail, I did the following:

curl -O https://rubygems.org/rubygems/rubygems-1.6.2.tgz

(and then unzipped it)

cd rubygems-1.6.2
chruby ruby-1.8.7-p374
ruby setup.rb
gem update --system 1.8.25

And then my RubyGems environment was fixed:

$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.25
- RUBY VERSION: 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin17.4.0]
- INSTALLATION DIRECTORY: /Users/keithpitty/.gem/ruby/1.8.7
- RUBY EXECUTABLE: /Users/keithpitty/.rubies/ruby-1.8.7-p374/bin/ruby
- EXECUTABLE DIRECTORY: /Users/keithpitty/.gem/ruby/1.8.7/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-17
- GEM PATHS:
- /Users/keithpitty/.gem/ruby/1.8.7
- /Users/keithpitty/.rubies/ruby-1.8.7-p374/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/

How do I change gem environment?

looking at the man page for bundle, I discovered 'bundle config'. It gave me the info I needed to find the problem. It told me it was getting some settings from /home/rails/.bundle/config . After examining that file, I found it was setting the BUNDLE_PATH to the incorrect setting. Moving that file aside allowed me to update the gem I wanted to. I guess the moral of the story is that 'bundle config' (more specifically, 'bundle exec bundle config') is your friend, and check your system for the settings in .bundle/config files if 'gem env' is giving unexpected results.

How to change the path where ruby gems are installed on OS 10.6.6 Ruby 1.8 and Rails 3

I would suggest using RVM (Ruby Version Manager) to control which version of Ruby you are installing your gems into. It will also help keep all the bundle and gem data in a folder in your home directory.

Change gem env RUBY EXECUTABLE path for one command

After hours and hours of research, stepping through the Ruby source with Pry, reading source code and more I figured out that this is not possible to do because it is hard-coded into ruby at compile time (wtf?). Anyway, the way to solve this is to simply recompile Ruby. Yeah.

There is also apparently a compile flag which you can set which removes this hard-coded environment: --enable-load-relative

After struggling with this for way to long I finally got this project working, where I have made an easy to use portable version of Ruby. Simply put, a folder with Ruby on it which you can move about, put on a USB stick or whatever, and it still works :)

RubyGems environment variables messed up :(

if there are multiple versions installed, project dependent version must be set as default.

To handle multiple projects with different dependencies, gemset can be used. RVM support gemset. Alternatives are available for rbenv also.



Related Topics



Leave a reply



Submit