Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rbenv: gem commands are not found on Linux Mint

Tags:

ruby

ubuntu

rbenv

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?

like image 621
Housni Avatar asked Mar 21 '16 16:03

Housni


People also ask

How do I know if Rbenv is installed?

You can see if it is using rbenv by typing which ruby and it should print something out with . rbenv/ whatever. If not you need to set rbenv as your current ruby. You can do that like rbenv global 2.1.

What does Rbenv mean?

rbenv is a tool that lets you install and run multiple versions of Ruby side-by-side.

What is Ruby Rbenv?

rbenv (Simple Ruby Version Management) lets you easily switch between multiple versions of Ruby. It is simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well. Another tool to be used for the same purpose is RVM.


1 Answers

try run rbenv global 2.3.0 && rbenv rehash

like image 167
Mike Belyakov Avatar answered Sep 20 '22 18:09

Mike Belyakov