1
votes

I am new to ruby, i want to set up a new hello application in ruby, but i get always this error: (i am using osx, mountain lion), what to do?

rails new hello /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in report_activate_error': RubyGem version error: rack(1.5.2 not ~> 1.4.5) (Gem::LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:inactivate' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in activate' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:ineach' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in activate' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:inactivate' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in each' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:inactivate' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem' from /usr/bin/rails:18

2

2 Answers

2
votes

You need to update your gems:

sudo gem update

However, you will also be a lot happier if you also update your ruby. There are various ways to do this, but I am particularly fond of rbenv, which you can find at github. If you install rbenv and also its plug-in ruby-build, you can ask rbenv to download and install a higher version of ruby in a single command. Note that you will need to have installed Xcode first, including the Xcode command-line tools.

In fact, I just tried this and it worked. I used rbenv and ruby-build to install Ruby 2.0 freshly on Mountain Lion, as described here:

http://www.apeth.com/nonblog/stories/ruby2onmountainlion.html

I switched rbenv to use ruby 2.0. That didn't include rails, though, so I then did gem install rails. Finally, I said: .rbenv/shims/rails new hello and it worked. (The only reason I had to specify the path like that is that I'd forgotten, in all the excitement, to do an rbenv rehash. Silly me.)

So this must work, because I just did it in real time, between the time you asked your question and the time I wrote this answer!

0
votes

It looks like your version of rack isn't supported with the version of ruby you are using. It also looks like you are using ruby 1.8, which is pretty outdated. I would try and go back and use 1.9.3, or ruby 2.0, which might solve your problem. Also, as far as text editors go, I would go with Sublime Text... http://www.sublimetext.com/2 It has a lot more shortcuts than TextMate.