11
votes

Whenever I open a new terminal window I now get:

-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory

Any idea as to why this is happening and how to get rid of it?

6

6 Answers

15
votes

Make sure the first line of the file /usr/local/bin/heroku is #!/path/to/ruby. You may need to change it from /usr/local/bin/ruby to /usr/bin/ruby, or if you cannot find the ruby executable, type which ruby or updatedb && locate ruby to find it.


If the above doesn't work...

Check your ~/.bashrc, ~/.inputrc~, /etc/bashrc, /etc/inputrc, /etc/profile for a line trying to execute /usr/local/bin/heroku.

Another idea is you might have this as one of your startup programs. Check in /etc/inittab for a line with /usr/local/bin/heroku.

If you still cannot find that line in any of those files you can run grep -iH heroku /*

2
votes
brew install wget
wget -qO- https://toolbelt.heroku.com/install.sh | sh
1
votes

-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory

You should firstly read the massage that the terminal throw out. /usr/local/bin/ruby: bad interpreter: No such file or directory that means there is no valid ruby command in the /usr/local/bin. So if you have install ruby but in another directory. You can use ln -s to link the /usr/local/bin/ directory. So find it out, such as /usr/bin/ruby. You can get into/usr/local/bin/directory run ln -s /usr/bin/ruby. If you have not started installing ruby, you should install it and make sure the ruby command in the /usr/local/bin directory

0
votes

How did you install heroku? If from source, you should recompile with proper directories.

You can edit /usr/local/bin/heroku but I think better when you recompile it (who knows where are more bad settings in heroku).

0
votes

I had a similar problem which resulted in the following error message when I tried to run any heroku commands:

(~/).gem/ruby/1.8/bin/heroku: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory

After some searching, I found a copy of the heroku-api gem in ~/.gem/ruby/1.8/cache. Deleting it and deleting the rubygems reference file in ~/.gem/ruby/1.8/bin solved the problem.

0
votes

I was running "pod init" in a directory. This gave me a similar error:

 -bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

Solution: install Cocoapods following the directions on their website.