Hartwig
Hartwig

Reputation: 1373

rbenv: no such command `init'

I installed rbenv according to the instructions at https://github.com/sstephenson/rbenv#section_2

Restarting my shell at point 4 will result in an error

$ rbenv init -
rbenv: no such command `init'

Trying to run the command directly from its folder doesn't work either.

$ cd .rbenv/bin
$ ./rbenv init -
rbenv: no such command `init'

My $PATH

$ echo $PATH
/home/myusername/.rbenv/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/myusername/bin

Running rbenv install works until rbenv rehash is called

$ rbenv install 1.9.3-p0
Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /home/hbrandl/.rbenv/versions/1.9.3-p0
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz...
Installing ruby-1.9.3-p0...
Installed ruby-1.9.3-p0 to /home/hbrandl/.rbenv/versions/1.9.3-p0
rbenv: no such command `rehash'

All other rbenv commands don't seem to work.

Any help or pointers greatly appreciated.

Upvotes: 4

Views: 6648

Answers (2)

Kelvin
Kelvin

Reputation: 20912

Check if the symlink is correct:

> ls -l ~/.rbenv/bin/rbenv
lrwxr-xr-x  1 kelvin  staff  16 Mar 29 11:19 /Users/kelvin/.rbenv/bin/rbenv@ -> ../libexec/rbenv

Is your rbenv a symlink to ../libexec/rbenv ? It should be, because it reads that symlink location to know that "libexec" is the location of the other executables.

To fix:

> cd ~/.rbenv/bin
> mv rbenv rbenv.broken
> ln -s ../libexec/rbenv rbenv

It might've broken if you copied the ~/.rbenv from another location, which would probably mess the links up.

Upvotes: 6

Hartwig
Hartwig

Reputation: 1373

A working workaround for my problem was to simply add the libexec folder to my path as well.

My rbenv PATH additions now look as follows:

export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/libexec:$PATH"

This fixes the problem for me.

Upvotes: 5

Related Questions