Jordan
Jordan

Reputation: 2523

Rails -v saying wrong rails version on Mac OSX

I've been trying to uninstall rails because it was on 4.1.0.rc1 and I wanted 4.0.0, so I ran

gem uninstall rails -v 4.1.0.rc1

And it said it was uninstalled successfully but typing

rails -v

still gives me 4.1.0.rc1

I tried running

gem cleanup

but it still is giving me the wrong version, I've quit the terminal and opened it back up and everything and am still getting the wrong version.

I just want to make sure that I am using the right version and everything is running smoothly. I've only been recently getting into ruby and learning how to install things in the terminal (I'm a recent mac convert) so all this stuff kind of wigs me out.

Upvotes: 3

Views: 2977

Answers (1)

Andreas Lyngstad
Andreas Lyngstad

Reputation: 4927

Look at the gemfile in your project.

It should have this line

gem 'rails', '4.0.0'

Go to your projects directory

and run

rails -v

This should return

Rails 4.0.0

If you do a rails -v outside any rails folder it show the newest version you have. But , inside a rails project folder it uses the version defined in the gem file.

When you greate a new rails project you can run

rails _<*version*>_ new <application_name>

in the case of 4.0.0

rails _4.0.0_ new myapp 

This will return the rails versions you have

gem list | grep rails

if this returns

rails (4.0.3, 4.0.0, 3.2.12)

and you run

gem uninstall railties -v 4.0.3

you go to back to rails 4.0.0 on the global system. But again in each rails project you be at whatever version that's specified in the gemfile.

Upvotes: 5

Related Questions