Making Rbenv Work With Zsh
I have heard lots of great things about zsh
. I had already installed zsh
in my system and tried out few times.
But I had not yet thought of using it as my default shell. Today, I decided to switch my default shell to zsh
.
Every new adoption comes with some learning experience. Zsh
has already come up with first challenge for me:
My rbenv
stopped working!
I would set my default ruby version to 2.3.0 and switch to some project folder and do ruby -v
and it would show 1.9.3-p374
as my ruby versions.
I copied some of my config from .bashrc
to .zshrc
with the hope to solve this problem.
# rbenv settings
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
But then I started getting error everytime I opened new terminal:
/home/fleck/.rbenv/libexec/../completions/rbenv.bash:16: command not found: complete
I searched a bit and found that I need to update my rbenv settings from eval "$(rbenv init -)"
to eval "$(rbenv init - zsh)"
in order to work normally.
With this change, My rbenv started working normally. Here is how my rbenv
settings in .zshrc
file looks like currently:
# rbenv settings
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init - zsh)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
Hope this helps you too.
Happy Learning!
References:
Leave a comment