Search code examples
rubyubunturbenv

rbenv: gem commands are not found on Linux Mint


I'm on Linux Mint 17.2. I recently removed ruby with apt-get purge ruby.

I then installed rbenv and then did rbenv install 2.3.0 so now, ~/.rbenv/versions/2.3.0/bin/ruby exists.

But now, I can't do gem install rubocop. I get this:

$ gem install rubocop
rbenv: gem: command not found

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

But I can do ~/.rbenv/versions/2.3.0/bin/gem install rubocop. However, once I'm done, I can't use it:

$ rubocop --auto-correct
-bash: /usr/local/bin/rubocop: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory

I also can't find out where this ruby came from:

$ dpkg -S /usr/bin/ruby1.9.1
dpkg-query: no path found matching pattern /usr/bin/ruby1.9.1

It's possible it was installed via RVM a long time ago.

Any idea how I can fix my Ruby?


Solution

  • try run rbenv global 2.3.0 && rbenv rehash