0

I'm trying to permanently (for the time being, that is) update my version of Ruby to 2.2.3 using chruby. It's currently 2.0.0.

Every time I quit the command line interface, the version reverts to 2.0.0, and when trying to use chruby (in a new session) to select 2.2.3, I receive a "command not found: chruby" message.

To get 2.2.3 running again, I have to type

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

followed by chruby 2.2.3. Doing so allows me to use 2.2.3 for the duration of the session. Exiting zsh (which is the shell I'm using) results in me having to go through the above again.

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146

1 Answers1

0

You need to configure chruby by adding those lines to your .zshrc. First to enable chruby:

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

and then to set a default:

chruby 2.2.3

(Those two lines will probably be right next to each other.)

Then when you upgrade Ruby (e.g. to 2.3.0) and want to make it your default, you would edit that line to chruby 2.3.0). Chruby, unlike e.g. RVM, doesn’t keep track of your default Ruby for you, you need to use your shell’s normal mechanisms for setting it.

matt
  • 78,533
  • 8
  • 163
  • 197