Skip to content

Instantly share code, notes, and snippets.

@mfilej
Last active August 1, 2018 21:05
Show Gist options
  • Save mfilej/4f3467acaff8c8a86407d4f1e7ea9e54 to your computer and use it in GitHub Desktop.
Save mfilej/4f3467acaff8c8a86407d4f1e7ea9e54 to your computer and use it in GitHub Desktop.
Switch ruby versions with direnv
source /usr/local/opt/chruby/share/chruby/chruby.sh
# Uncomment to use with rubies installed with ruby-build:
# RUBIES+=(~/.rbenv/versions/*)
# use ruby [version]
use_ruby() {
local ver=$1
if [[ -z $ver ]] && [[ -f .ruby-version ]]; then
ver=$(cat .ruby-version)
fi
if [[ -z $ver ]]; then
echo Unknown ruby version
exit 1
fi
chruby $ver
}
@mfilej
Copy link
Author

mfilej commented Jul 28, 2018

Append the above to your ~/.direnvrc. See article for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment