I previously installed rails with the preinstalled ruby that comes with mac. I have recently installed ruby through rvm.
I then did
rails -v
and got the following error
kingsosina$ rails -v
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'railties' (>= 0) among 5 total gem(s) (Gem::LoadError)
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:309:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rails:22:in `<main>'
What has gone wrong here? Do I need to gem install rails again?
my lastest output
kingsosina$ which ruby
/Users/kingsosina/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
kingsosina$ which rails
/Users/kingsosina/.rvm/gems/ruby-2.0.0-p353/bin/rails
kingsosina$ which gem
/Users/kingsosina/.rvm/rubies/ruby-2.0.0-p353/bin/gem
kingsosina$
Does everything seem ok? and how does terminal know to reference this version of ruby instead of the pre-installed version on the mac, when i do ruby -v?
For what it's worth, the paths shown in your error output indicate that you're still referencing the OSX version of ruby. You'll want to enter the directory and type
rvm use X.X.X-pXXX
where X.X.X-pXXX is the ruby version that you want rvm to use. You can also add a file called .ruby-version with X.X.X-pXXX in it and rvm and other ruby version managers will switch to the appropriate version for you. Adding a .ruby-gemset file will also switch to the appropriate set of gems.
Finally, you'll need to make sure that the gems are installed in the rvm ruby/gemset combination. Putting that all together, to get started with the latest ruby and latest rails gem you would...
rvm install 2.0.0
rvm use 2.0.0
rvm gemset use --create my-project-gems
gem install rails
Did you install newer version of ruby along with the rvm install? Do rvm list to find out what rubies your have installed. Then do rvm use <ruby-version-here> to select a ruby with rvm. Then you need to gem install rails again because its a new ruby. If you get a permission denied error trying to install gems try rvmsudo gem install rails.
Related
I try to create new app with "rails new" command however getting this error:
'report_activate_error': Could not find RubyGem railties (>= 0) (Gem::LoadError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:244:in 'activate_dep'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:236:in `activate'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1307:in `gem'
from /usr/local/bin/rails:18
Any idea why?
by the way I am working on Ubuntu
gem list
*** LOCAL GEMS ***
it is empty but I installed rails just before
I have encountered the issue before.The solution is :
you must use comand gem install rails, not sudo gem install rails.
I encountered the same problem and found the following solution Here which was mentioned here. Hope it helps
After you installed RVM and after you set the default Ruby version in RVM, you need to re-install all ruby gems, e.g.
gem install rails
you need to install those gems as the user, not as root.
Because from now on RVM will keep track of all installed gems by the ruby version which was used to install them!
You need to install RVM (I don't know it is the best solution but it works) then use such rails commands like rvmsudo rails new or such. I use rails and ruby command with including rvm or rvmsudo phase and all of them start to work.
Do you have multiple Ruby installations on your system? Maybe you have installed some package (like Heroku with full installation) and you are using the 'new' Ruby installation. I have uninstalled the last Ruby and everything seems to be fine.
Edit: Not everything is fine... yet. Under Windows you will have to edit Heroku.bat (in your Program Files/Heroku path) and change the path to Ruby installation folder.
Install rvm and try it again to install rails
RVM provides a very great way to manage your gems in Gemsets
for multible ruby installations.
On the offizial rvm site is a installation tutorial
http://beginrescueend.com/
I had already installed rails 1.8.7, forgot about it, then installed 1.9.3 through RVM. I was getting weird errors, so I purged my Mac of the system version of Ruby and started again using RVM. So far I've
Installed Ruby:
rvm reinstall 1.9.3-p0
which ruby
/Users/User/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
Manually setup Rubygems
which gem
/Users/User/.rvm/rubies/ruby-1.9.3-p0/bin/gem
Tried to install rails
sudo gem install rails
Successfully installed rails-3.2.1
1 gem installed
gem list
rails (3.2.1, 3.2.0)
It says rails is installed, but which gem does not work, and when I try to use rails new I get:
-bash: rails: command not found
I'm definitely missing something here. The only explanation I can think of is that there are remnants of a previous ruby or rails install that's causing problems. Is there a way to start completely from scratch?
If you are using RVM, you should not use "sudo" when you install gems. That will install gems to your system ruby version (not on the RVM rubies).
First, set up default rvm ruby like
rvm use ruby-1.9.3-p0 --default
Then, install rails on it by running:
gem install rails -v=3.2.1
It's actually better to use gemsets so you can have different gems set for the same ruby version. Check here for more info.
I'm using Rails 2.3.11 and Bundler 1.0.10.
Passenger returns the error
Could not find addressable-2.2.4 in any of the sources (Bundler::GemNotFound)
I installed manually addressable 2.2.4 and I bundled it with gem 'addressable', '2.2.4' did a bundle install and bundler says Using addressable (2.2.4).
Still there is the error of above.
I'm using Passenger as an Apache2 module. I'm using RVM with Ruby 1.9.2. Passenger runs with 1.8.7. Even switching Ruby to 1.8.7 using RVM doesn't solve the problem.
Along with what Zachary said, that is making sure you have the right gemset selected, be sure to run
bundle install
in the directory of the project. In my case for a Padrino project, once i ran bundle, it worked fine (with that gemset selected).
If you're using RVM there's a good chance your gemset for your project is not synched up.
Try doing
rvm gemset list
If you created a ruby for this project and a gemset for it, it will be listed there. Do
rvm gemset use nameOfGemsetForYourProject
RVM is a great tool, but it can muddy the waters and cause some confusion with making sure you're installing a gem under the correct namespace.
To check what gems are installed for a gemset, after you have done a 'use' on it, just type "gem list"
I'm going through the rails by example tutorial.
Its seems that every time I close terminal rails defaults back to 2.3.5 & I have to go through the process of installing 3.0.3 every time I open the terminal?
I installed rails using: $ [sudo] gem install rails --version 3.0.3
Has anyone experienced a similar issue? I've tried googling around and searching stack to no avail.
The problem is almost-assuredly RVM interpreting 2.3.5 as your default rails version in your default gem set. I ran into this problem myself when first experimenting with RVM. Try this:
rvm --default use 1.9.2 (or whatever you want your default ruby interpreter to be)
rvm gemset create rails-3.0.3
rvm use 1.9.2#arails-3.0.3 --default
gem install rails
That will:
Set your default ruby interpreter to the desired ruby version
Create a gemset for your Rails 3.0.3 install and make it your default gemset
Install rails
Once you close the terminal and open it back up, it'll load RVM's defaults, putting you back on Rails 3.0.3 again.
Try uninstalling the rails gem:
gem uninstall rails
If you are prompted to select a version, select 2.3.5 and leave the 3.0.3 version intact.
P.S: Are you using RVM? If not, I would highly recommend it.
I've had this problem using RVM, if you're using RVM do: $rvm 1.9.2 (or whatever ruby version you installed the rails 3 gem with).
Check the output of $ ruby -v when you seem to have access to rails3 and again $ ruby -v when you can only seem to get to v2.3.5. If it shows different versions of ruby then you most likley are using RVM.
#Ads If youre using RVM and you install rails using sudo like so
$ [sudo] gem install rails --version 3.0.3
youre doing it wrong. RVM depends on you using a ruby distro that was installed by RVM into your user directory. If youre using sudo, youre installing rails gem into your system-wide ruby.
So check that youre using the right ruby version by doing 'rvm info' and then do your 'gem install rails --version 3.0.3' without sudo
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