When switching from bash to zsh, I looked up how to resolve an issue with my rbenv folder not being used correctly by zsh and found this:
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
$ echo 'eval "$(rbenv init -)"' >> ~/.zshenv
$ echo 'source $HOME/.zshenv' >> ~/.zshrc
$ exec $SHELL
I ran all of these and seem to be using the correct rbenv folder now, but I get this error message whenever I open a new iTerm window:
/Users/myname/.zshenv:2: command not found: rbenv
What am I doing wrong? Any help would be very appreciated.
You need to add two things to your PATH
.
First rbenv
itself and second the ruby shims
.
If you installed rbenv
with brew
,
then the rbenv
executable should be linked to /usr/local/bin/rbenv
.
See homebrew installation documentation for details.
Please add /usr/local/bin
to your path PATH
, if it is missing.
# in ~/.zshrc
export PATH=/usr/local/bin:$PATH
If you install rbenv
via a Github checkout, then the rbenv
executalbe should be stored in ~/.rbenv/bin
.
See github installation documentation for details.
Please add ~/.rbenv/bin
to your path PATH
, if it is missing.
# in ~/.zshrc
export PATH=$HOME/.rbenv/bin:$PATH
Please verify that rbenv
is in your path by calling which rbenv
.
The installation path should be returend.
Add the ruby shims
to you path.
# in ~/.zshrc
eval "$(rbenv init -)"
Instead of the eval "$(rbenv init -)"
command you can also add the shims
folder directly.
# in ~/.zshrc
export RBENV_ROOT=$HOME/.rbenv
export PATH=$RBENV_ROOT/shims:/versions:$PATH
You might also run the rbenv-doctor
script mentioned here,
to check your installation.
I had the same problem... when I ran ruby or rbenv, I got this error "command not found"
try this:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
echo 'eval "$(rbenv init - zsh)"' >> ~/.zshenv
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.zshenv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With