Rbenv: no such command as 'init-'




I’m on Mac OS and I’m trying to install Ruby on Step 3.1 after running

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

in the command line and restarting Terminal I get the following message at the top:

rbenv: no such command 'init-'

I was wondering if this was going to be a problem moving forward or can I just carry on?


Did you run install rbenv by running brew install rbenv and then rbenv init?


Yes, I ran

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

and restarted terminal as is says to and when I restarted I saw the no such command message


Hey! I’ve literally just had the same problem and it’s taken me hours to work it out…

When you hit put rbenv init into the terminal what do you get out?

It was telling me to append the file with ~/.zshrc instead of the bash_profile one. Make sure you try closing the terminal and reloading after this too.

So I did echo 'eval "$(rbenv init -)"' >> ~/.zshrc instead of the other one.

Let me know if that helps you out!


When you hit put rbenv init into the terminal what do you get out?

I get:

# Load rbenv automatically by appending
# the following to ~/.bash_profile:

eval "$(rbenv init -)"

So I enter:

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

And then I close and open terminal again and still get the original: rbenv: no such command 'init-' message

I tried entering yours, but same result.


What is the output of

brew install rbenv

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
armadillo    etcd         gocryptfs    math-comp    pspg
aws-sdk-cpp  exploitdb    inlets       maxwell      screenfetch
bazel        flyway       lerna        meson        terragrunt
coq          folly        libpcap      minio-mc     typescript
duo_unix     ginac        librdkafka   ola          zshdb
erlang       gmic         libsass      ppsspp
==> Deleted Formulae
protobuf@3.1                    supersonic

Warning: rbenv 1.1.2 is already installed and up-to-date
To reinstall 1.1.2, run `brew reinstall rbenv`


Try rbenv rehash in the terminal.


I ran rbenv rehash in the terminal and there was no output. Closed and restarted terminal and still see rbenv: no such command 'init-'at the top of the new terminal session.


Do you know what kind of terminal you are using?


I’m on Mac OS using the default bash shell of Terminal, I believe.


What’s the output of ls -l ~/.rbenv/bin/rbenv


If you are using Mac OS Catalina, you are now using zsh, not bash, by default.


I haven’t updated my OS yet so it’s still bash.


ls: /Users/ericgwilliams94/.rbenv/bin/rbenv: No such file or directory


It looks like rbenv isn’t being installed correctly via homebrew.

What about just ls -l ~/.rbenv/


It returns:

drwxr-xr-x  11 ericgwilliams94  staff  352 Oct 11 06:20 shims
-rw-r--r--   1 ericgwilliams94  staff    6 Oct  8 17:24 version
drwxr-xr-x   3 ericgwilliams94  staff   96 Oct  1 17:19 versions


You can maybe try the solutions here

It’s a weird issue.