0

I am using chruby to manage changing my rubies.

I also use tmux.

When I change to a different Ruby, chruby updates the PATH environment variable to include the path to the Ruby I want. When I start a tmux session, these modifications to PATH are lost.

How can I get tmux to retain the PATH variable when creating a new session?

UPDATE

I think I just need to read the instructions more carefully!

I have moved the source line from ~/.zshrc to ~/.zprofile

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

Now when I create a tmux session, the PATH includes the path to my Ruby, but it doesn't work because the PATH ends up duplicated like this:

Before

/Users/jord/.gem/ruby/1.9.3/bin:/Users/jord/.rubies/ruby-1.9.3-p385/lib/ruby/gems/1.9.1/bin:/Users/jord/.rubies/ruby-1.9.3-p385/bin:/Users/jord/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

After

/Users/jord/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/jord/.gem/ruby/1.9.3/bin:/Users/jord/.rubies/ruby-1.9.3-p385/lib/ruby/gems/1.9.1/bin:/Users/jord/.rubie s/ruby-1.9.3-p385/bin:/Users/jord/bin:/usr/local/share/npm/bin:/usr/local/sbin

I assume this is because of the way I am setting my PATH in ~/.zshrc?

PATH="$HOME/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:$PATH"

Should I just explicitly state my path? Or should that not be set in ~/.zshrc?

jordelver
  • 8,292
  • 2
  • 32
  • 40

1 Answers1

0

This should have been fixed in 0.3.0, what version of chruby are you using?

postmodern
  • 454
  • 3
  • 3