/usr/bin/ruby2.3: bad interpreter: No such file or directory

Viewed 8755

I am running Ubuntu 16.04 and when I open the console and write rails s to start my rails server, following error appears:

bash: /usr/local/bin/rails: /usr/bin/ruby2.3: bad interpreter: No such file or directory but if I use command bash -l then use rails s every thing works fine.

why do I always need to use bash -lcommand to use rails s ? How can I save myself from the overhead of always writing bash -l?

2 Answers

First location your ruby install:

which ruby

add path to env variables:

vi ~/.bashrc
export PATH=$PATH:/usr/local/ruby-2.6.5/bin

Next, location bundle which bundle

edit bundle first line

vi  /usr/local/bin/bundle

#!/usr/bin/ruby2.3
TO
/usr/local/ruby-2.6.5/bin/ruby
Related