Rails 3: Ruby 1.9.2: does it need / usr / bin / ruby1.8?

I am trying to get Michael Hartle's Rails tutorial . I spent a lot of time with various libraries. So I uninstalled all ruby โ€‹โ€‹software from my Ubuntu 10.4 system.

Then I installed Ruby 1.9.2.

$ ruby -v ruby 1.9.2dev (2010-07-02) [i486-linux] 

So far so good. Then i did

  sudo gem install rails 

After a long time, he completed the installation. Then i ran

  $ rails -v bash: /usr/bin/rails: /usr/bin/ruby1.8: bad interpreter: No such file or directory 

So ... I don't have / usr / bin / ruby โ€‹โ€‹1.8 on my system. How to get Rails 3.0.3 to use my ruby โ€‹โ€‹in / usr / bin / ruby?

I appreciate any help you can give me.

Just to see if I can continue, I tried

  $ cd /usr/bin $ sudo ln -s ruby1.9.2 ruby1.8 

This allows me to continue, but is it right to do it?

+8
ruby-on-rails-3
source share
5 answers

It took three different ways to install and uninstall Ruby, but I finally got it!

I found a great Toran Billups tutorial that gives some great instructions. After analyzing what he did, it comes down to a few key concepts:

  • Some libraries that are not dependent on the version of Ruby must be installed on the system (using "sudo apt-get").
  • Use RVM to install Ruby in your account. those. no "sudo".
  • Use the gem to set gems in your particular ruby โ€‹โ€‹environment. (i.e. no โ€œsudoโ€). When you install 1.8 as a Ruby environment, gems are installed in the RVM 1.8 tree in your environment. When you install 1.9.2 as your environment, gems are installed in the 1.9.2 tree in your environment.

Here, therefore, there is a process.

  • Remove all Ruby programs (1.8.x and 1.9.2) and Ruby libraries from your Ubuntu 10.4 system.
  • Install RVM on your system by following the instructions on RVM site (broken) RVM site .
  • Follow the Toran Billups tutorial from the moment you install Ruby 1.8.7.
  • Follow the instructions in Tutorial Michael Hartl (not working) Michael Hartl tutorial to get Rails 3.0 working with Ruby 1.9.2, github, heroku.com, rspec, spork and autotest.
+3
source share

I had the same error after installing with RVM and opening new shells. The solution was supposed to run:

 $ rvm use 1.9.2 --default 

PS
I am running Ubuntu 10.04 and after two days of trial and error, I finally got rails 3 working with ruby โ€‹โ€‹1.9.2. I highly recommend using RVM to install ruby โ€‹โ€‹- a godsend!

+2
source share

From the sounds of this, Bash finds ruby1.8 when it runs the line #!/usr/bin/env ruby from the rails of the script, even if it does not exist. Try /usr/bin/env which ruby to see which interpreter is trying to load.

0
source share

I also had a headache with this, and I don't want to use RVM right now.

I saw that the shebang line for / usr / bin / gem was #! / Usr / bin / ruby1.8 and that this seems to be the problem.

I made sure / etc / alternatives points to the correct gem script; this can be set using:

update-alternatives --config gem

Then I deleted / usr / bin / gem and marked / usr / bin / gem in / etc / alternatives / gem

Turns out the only difference in the gem scenarios is the shebang line, so manual change would work too.

0
source share

Solved by changing the version of my current Ruby (using RVM) to 2.0.x.

When I installed the rails (two days ago), it was under version 2.0.0. Yesterday I switched to 2.1.x. Today I tried the rails command and got an error.

So, back to the RVM Ruby version, I installed the rails, did the trick.

Sorry bad english.

PS Using Ubuntu 13.10

0
source share

Source: https://habr.com/ru/post/650216/


All Articles