Search code examples
ruby-on-railsrubyubuntuterminalrubymine

RubyMine Using Incorrect/Different Ruby Version - Ubuntu


I'm on an Ubuntu system and have installed ruby-2.1.3 using rbenv. I have made 2.1.3 global and it is accessible from my system terminal.

System Terminal:

lambda@lambda-PC:~$ ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]

However, when I run the same command in my RubyMine embedded terminal, it asks me to install ruby through the aptitude repository.

lamdba@lambda-PC:~/RubymineProjects/Loccasions$ ruby -v
The program 'ruby' can be found in the following packages:
 * ruby
 * ruby1.8
Try: sudo apt-get install <selected package>

The same thing goes for "gem environment" and "gem -v".

System Terminal:

lambda@lambda-PC:~$ gem -v
2.4.2
lambda@lambda-PC:~$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.2
  - RUBY VERSION: 2.1.3 (2014-09-19 patchlevel 242) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/lambda/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0
  - RUBY EXECUTABLE: /home/lambda/.rbenv/versions/2.1.3/bin/ruby
  - EXECUTABLE DIRECTORY: /home/lambda/.rbenv/versions/2.1.3/bin
  - SPEC CACHE DIRECTORY: /home/lambda/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/lambda/.rbenv/versions/2.1.3/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/lambda/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0
     - /home/lambda/.gem/ruby/2.1.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/lambda/.rbenv/versions/2.1.3/bin
     - /home/lambda/.rbenv/libexec
     - /home/lambda/.rbenv/plugins/ruby-build/bin
     - /home/lambda/.rbenv/shims
     - /home/lambda/.rbenv/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games

RubyMine Terminal:

lambda@lambda-PC:~/RubymineProjects/Loccasions$ gem -v
The program 'gem' can be found in the following packages:
 * ruby
 * rubygems
Try: sudo apt-get install <selected package>

lambda@lambda-PC:~/RubymineProjects/Loccasions$ gem environment
The program 'gem' can be found in the following packages:
 * ruby
 * rubygems
Try: sudo apt-get install <selected package>

I have sifted through all of the settings that I'm aware of in RubyMine that relate to the SDK, and have directed them the ruby-2.1.3 stored in rbenv. I have done much research on this topic, but my attempts are futile. I would appreciate help in diagnosing this error.


Solution

  • I added $HOME/.rbenv/shims to my path through

    export PATH="$HOME/.rbenv/shims:$PATH"
    

    And it works!