Rbenv: -bash: rbenv: command not found

Created on 29 Oct 2013  路  15Comments  路  Source: rbenv/rbenv

I'm running Mac 10.9 with Xcode 5.0.1 Command Line Tools installed. I'm trying to follow rbenv's "Installation" steps under "Basic GitHub Checkout":

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

...I restart Terminal and receive this error:

-bash: rbenv: command not found

My .bash_profile previously contained these paths for node/npm and git:

export PATH="/usr/local/bin:/usr/local/git/bin:$PATH"

...after following the steps above my .bash_profile now looks like this:

export PATH="/usr/local/bin:/usr/local/git/bin:$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

Here are my troubleshooting answers:

which rbenv
(no response)

...and:

echo $PATH | grep --color=auto "$(rbenv root)/shims"
-bash: rbenv: command not found

Any ideas as to what I need to edit in my .bash_profile to get rbenv working?

Most helpful comment

Restart your shell
exec -l $SHELL

All 15 comments

Your .bash_profile looks OK. Does echo $PATH in your shell look OK, i.e. does it include rbenv's directories? Is rbenv present in ~/.rbenv/bin/rbenv, i.e. did the git clone finish successfully?

@mislav I have no idea what happened, but there wasn't a ./rbenv folder in my home directory. I guess the git clone didn't finish successfully. I did another git clone and everything's working perfectly now.

Thanks for your help.

Sorry to reopen this, but it doesn't seem my rbenv install is working. It seems to be pointing to my /Library Ruby.

Here are my troubleshooting answers and a gem update for good measure.

which rbenv
/Users/ryan/.rbenv/bin/rbenv

echo $PATH | grep --color=auto "$(rbenv root)/shims"
/Users/ryan/.rbenv/shims:/usr/local/bin:/usr/local/git/bin:/Users/ryan/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin

rbenv install -l
rbenv: no such command `install'

gem update --system
Updating rubygems-update
Fetching: rubygems-update-2.1.10.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

Here's my Gist:
https://gist.github.com/ryanburnett/7235972

Any other ideas?

The install command is provided by ruby-build, not rbenv, and requires additional steps to install.

@graywh Here's what happens when I try to install a gem:

gem install compass
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

If rbenv is installed correctly shouldn't gems install to rbenv instead of my /Library Ruby environment?

What version of ruby are you current using? rbenv versions

rbenv versions

  • system (set by /Users/ryan/.rbenv/version)

How can I change it from system?

Got it - thanks for your help.

Restart your shell
exec -l $SHELL

@alishahpakneeds that command you shared solved a similar issue for me, thank you.

@alishahpakneeds that command you shared solved my problem to install ruby, thank you.

@aliabbas-2012 Solved the problem here!

Resolved removing ~Rbenv validation from /.bash_profile

You can run the command by setting its path

RUN PATH="$HOME/.rbenv/bin:$PATH" rbenv install ${RUBY_VERSION}

Was this page helpful?
0 / 5 - 0 ratings