chruby: Auto-switching not working

Hey everyone,

I’m using chruby installed via Homebrew with ruby-build. I installed Ruby 2.0.0-p247 to /opt/rubies/2.0.0-p247. I can switch to it fine manually, but the auto.sh script is not working when I cd into a directory with a .ruby-version file.

.ruby-version:

2.0.0-p247

.bashrc:

export PS1='\w $ '
homebrew=/usr/local/bin:/usr/local/sbin
export PATH=$homebrew:$PATH

source /usr/local/opt/chruby/share/chruby/chruby.sh
source /usr/local/opt/chruby/share/chruby/auto.sh

.bash_profile

if [ -f ~/.bashrc ]; then
  source ~/.bashrc
fi

About this issue

  • Original URL
  • State: open
  • Created 11 years ago
  • Comments: 32 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I recently switch from zsh to bash, and I’ve come across an issue that seems to be related to the above discussion. If I change to a directory containing a .ruby-version file and then start tmux, the tmux session has RUBY_AUTO_VERSION set as expected, but the current ruby version does not match.

I realized there is a tricky order dependency in when you set your default ruby and source the auto script. I fixed it in my env.

Thanks @iamveryyour fix worked for me too! 😃