Can't run rails command when installing Rails without RVM - ruby-on-rails

I can't get to install rails correctly, after doing "sudo gem install rails", all goes well, but if I try doing "rails -v", I get "Rails is not currently installed on this system...", I'm not using RVM, I installied Ruby through Homebrew.
The rails executable is in "/usr/local/Cellar/ruby/1.9.3-p286/bin/rails", but even if I add that path to my $PATH it won't find it, or something else in RubyGems is going wrong...

With homebrew, just use gem install rails or any gem name. Dont use sudo. That works for me.
$ which rails
/usr/local/Cellar/ruby/1.9.3-p194/bin/rails

Related

Rails/Spree -bash: spree: command not found

I have worked with rails before and i thought that i would try out spree to learn more about engines. Following the getting started tutorial on sprees documentation it seemed very strait forward. I installed the gem gem install spree_cmd and then added gem 'spree' to the gemfile and ran bundler which ran fine. It installed several spree gems. But on the instruction to run spree install --auto-accept it returns
$ spree install --auto-accept
-bash: spree: command not found
I am running on mac OS X 10.8.4. ruby 1.9.3p327 rails 2.3.13 and rbenv and my ruby manager
any thing i am missing?
You should try to Add gem 'spree' to the Gemfile and after that
$ bundle install
and then $ spree install --auto-accept
I got this problem too! And I tried to search for a solution. Well, spree require an exact version of ruby and rails. So I think you need to install a correct ruby version. Try run :
$rbenv install 2.0.0-p247
This makes the spree command works for me

ruby on rails install help

So I run this command successfully: sudo gem install rails
It outputs: Successfully installed rails-3.0.10
However, whenever I type in rails -v it shows: Rails 1.2.6
How can this be? Whenever I create a new project and do rails server, localhost:3000 doesn't work.
It's likely that your system has rails preinstalled, and the rubygems version is not overriding it.
You might have luck installing rvm and then installing rails within an rvm gemset.

How to Run Rails 2.3.8

I have been working on installing Rails. However, I am ending up with 2.2.3 and I need 2.3.8.
What I did was I installed ruby via:
apt-get install ruby build-essential #installed 1.8.7
apt-get install rubygems #installed 1.3.6
gem install rails-v2.3.8
I tried to run this but it didn't work. Ubuntu didn't know the command, 'rails' in rails new blog.
I tried to remedy this by installing rails, not via gem but by apt-get:
apt-get install rails
The version installed was rails 2.2.3
What should I be doing to install Rails 2.3.8?
gem install rails -v 2.3.8 should do it. Rails 2 makes a project like "rails name_of_project", without the new keyword. Do a "gem list" to check whether Rails 2.3.8 is installed. If it is, it may be that rails is not in your path.
Edit:
I think that it would work if you add
"export
PATH=/var/lib/gems/1.8/bin:$PATH" to
your ~/.bashrc. I can't really verify
because i work on mac os, but i think
it would. Else, try to execute a "find /
-name "rails" to locate it and add that to your path.
You can install Ruby Version Manager and change version what you want.

problem with rails instalation need 2.3.8 after installation still getting "rails -v" = "Rails 2.3.5"

I'm trying to setup clockingit but...
even after
gem install -v=2.3.8 rails
1 gem installed
i'm getting
rails -v
Rails 2.3.5
I need 2.3.8 to rake the gems for clockingit
help greatly apreciated
Try gem install -v 2.3.8 rails (no equal sign). You should also check if the version of Ruby on Rails installed through RubyGems is used at all. Maybe a version of Ruby on Rails installed through the package management of your operating system overlaps the version installed through RubyGems.
Try to use rvm. It is dead simple to deal with, and makes managing gems very easy. If you already on rvm, try to create another gemset
rvm gemset create new_gemset
and the try to install rails

Rails 2.3.8 problem

I am running Ruby 1.9.1 & rails 2.3.8. Everything is installed fine as far as I can tell but when I run rake db:migrate I get this error:
Missing the Rails 2.3.8 gem. Please gem install -v=2.3.8 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
So I wanted to make sure I had rails installed and ran from the command line rails -v & it says Rails 2.3.8. So I am not sure what gives here. Can anyone point me in the right direction? thank you very much.
Well, if you really have those versions installed and you get the error, something may be wrong.
But, you can do as the message recommends and comment out the setting in your config/environment.rb so it tries to use whatever version you have installed.
Did you install rails with a different package manager? If I install rails with "sudo apt-get install rails" then "rails -v" uses the rails binary in /bin (even if it's 2.3.5 or 2.0.2) because that is first in my path. If after that I install rails with "sudo gem install rails -v=2.3.8" typing "rails -v" still gives me the version of the /bin rails. I haven't verified, but I would guess this is the same issue if you're using macports. If you uninstall the package you installed with the non rubygems package manger and then reinstall rails with rubygems that may fix your issue.
Hope this helps.

Resources