Rbenv: no such command as 'init-'

self-taught

#1

Hello!

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?


#2

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


#3

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


#4

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!


#5

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.


#6

What is the output of

brew install rbenv


#7
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`

#8

Try rbenv rehash in the terminal.


#9

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.


#10

Do you know what kind of terminal you are using?


#11

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


#12

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


#13

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


#14

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


#15

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


#16

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

What about just ls -l ~/.rbenv/


#18

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

#19

You can maybe try the solutions here

It’s a weird issue.