Search code examples
rubyubunturbenv

Ruby successfully installed with rbenv but is unaccessible


I installed rbenv and ruby-build, ran rbenv install 2.3.0 and it succeeded. However I can't use any Ruby commands. Here are the various errors I get:

user@ubuntu:~$ gem install bundler
rbenv: gem: command not found

The `gem' command exists in these Ruby versions:
  2.3.0

user@ubuntu:~$ ruby -v
rbenv: ruby: command not found

The `ruby' command exists in these Ruby versions:
  2.3.0

user@ubuntu:~$ rbenv install 2.3.0
rbenv: /home/user/.rbenv/versions/2.3.0 already exists
continue with installation? (y/N)

2.3.0 exists in ~/.rbenv/versions:

user@ubuntu:~$ cd ~/.rbenv
user@ubuntu:~/.rbenv$ ls
bin          libexec  plugins  README.md  src   versions
completions  LICENSE  rbenv.d  shims      test
user@ubuntu:~/.rbenv$ cd versions
user@ubuntu:~/.rbenv/versions$ ls
2.3.0

I restarted the machine and tried reinstalling but I get the same thing. Ruby has never been installed on this machine.


Solution

  • Try to run rbenv global 2.3.0.