Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with heroku toolbelt

I'm absolute newbie in Ruby and Rails project, so I'm sorry if this is dumb question.

I've installed heroku toolbelt using wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh. Also I tried gem install heroku. But when I type:

MY_USER@home-PC:~$ heroku version
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'

I've checked in google and people suggest that gem and current ruby are different versions so I've checked it and they seem to the same:

MY_USER@home-PC:~$ which ruby
/home/MY_USER/.rvm/rubies/ruby-1.9.3-p327/bin/ruby

MY_USER@home-PC:~$ gem env | grep 'RUBY EXECUTABLE'
  - RUBY EXECUTABLE: /home/MY_USER/.rvm/rubies/ruby-1.9.3-p327/bin/ruby

I have no idea what to do more, so please help.

Sorry for the maybe stupid question, thanks in advance.

EDIT: Forgot to say I'm running Ubuntu 12.10.

like image 796
suricactus Avatar asked Nov 17 '12 15:11

suricactus


1 Answers

The problem is that the heroku executable you installed probably starts with a line like this:

#!/usr/bin/ruby

This will force the heroku command to always use the system-wide ruby (/usr/bin/ruby) and it will never run your rvm version of ruby.

To fix it simply edit the first line of the heroku script to this:

#!/usr/bin/env ruby

This will make the heroku command run whichever ruby command is in the current PATH, instead of a hard coded path like previously.

To find the location of the heroku script, so you can edit it, simply type:

which heroku

It should print out the location of the script so you can find it and load it into your editor.

like image 86
Casper Avatar answered Oct 17 '22 00:10

Casper