Comments (8)
It appears the GEM_HOME
/ GEM_PATH
variables are not being exported to the sub-shell. Could you echo their values from within the sub-shell?
from chgems.
Here are the values:
GEM_HOME
:/Users/janogonzalez/.gem/ruby/2.0.0
GEM_PATH
:/Users/janogonzalez/.gem/ruby/2.0.0:/Users/janogonzalez/.rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0:/Users/janogonzalez/.gem/ruby/2.0.0
I also noticed that chgems
works properly when used without chruby
.
from chgems.
Reproduced. Somehow chruby is incorrectly removing the gem dir added by chgems.
.zshrc
source /usr/local/share/chruby/chruby.sh
echo "Before: $GEM_PATH"
chruby ruby-2.0
echo "After: $GEM_PATH"
Output
$ chruby jruby-1.7.4 rubinius-2.0.0-rc1 ruby-1.8.7-p374 ruby-1.9.3-p448 * ruby-2.0.0-p247 $ chgems Entering /vault/1/code/ronin with gems in .gem/ruby/2.0.0/ ... Before: /vault/1/code/ronin/.gem/ruby/2.0.0:/home/hal/.gem/ruby/2.0.0:/opt/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0 After: /home/hal/.gem/ruby/2.0.0:/opt/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0:/home/hal/.gem/ruby/2.0.0
from chgems.
Ah ha, the problem is your calling chruby 2.0
in .zshrc
. Before switching to a new Ruby, chruby_use
will call chruby_reset
which cleans PATH
, GEM_PATH
and unsets GEM_HOME
. Since chgems
spawns a sub-shell with GEM_HOME
set, chruby_reset
thinks it's another Ruby's GEM_HOME
and removes it from PATH
/GEM_PATH
.
from chgems.
Double ah ha. The solution is to put chruby ruby-2.0
in ~/.zprofile
, which will only be loaded when spawning login shells, not sub-shells.
from chgems.
.zprofile
is loaded before .zshrc
so the solution is not working. I also tried the autoswitching approach without any luck. I don't know enough zsh to find the solution so I will try to find someone to help me.
Maybe a shell function is the way to make it work in zsh?
from chgems.
Try putting the following in .zprofile
:
source /usr/local/share/chruby/chruby.sh
chruby ruby-2.0
from chgems.
Oh, a zsh user pointed out that .zlogin
is loaded after .zshrc
. Perhaps I should recommend using that file instead of .zprofile
.
from chgems.
Related Issues (15)
- No profile.d in Snow Leopard HOT 3
- Running 'chgems' resets the ruby version set by 'chruby' HOT 17
- chruby is overriding the environment variables after chgems sets them HOT 14
- chgems for "global" gems? HOT 2
- zsh: warning about `shift` HOT 3
- Add support for .ruby-version HOT 3
- Not Setting Environment HOT 6
- Archive the repository
- Leave my PS1 alone! HOT 4
- When using auto-switch sub-shell uses system ruby instead of .ruby-version
- Errors encountered running in Ubuntu HOT 2
- PGP asc URL 404 HOT 1
- presence of a .ruby-version file and chruby autoswitching is resetting and overriding chgems HOT 4
- The `-f` switch on readlink is missing on Mac OS X HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chgems.