Rick
Rick

Reputation: 45

ruby, rubygems & rails - getting everything in the right place!

So - a little bit of background on the system I'm running. I'm on a Mac running Snow Leopard.

I know that Snow Leopard comes pre-installed with Ruby and Rails - but I think I may have messed things up as I found this out after I installed Ruby and Rails again.

When I run ruby -v it displays that I am running ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]. Even though I've gone through the process to try and install 1.9.2!

When I run rails -v it displays that I am running Rails 2.3.5

When I run mysql -v it displays that I am running 5.1.56 MySQL Community Server (GPL)

I can get into the interactive ruby shell and I can get into mysql prompt. However, when I try to run ruby script/console, it comes up with: ruby: No such file or directory -- script/console (LoadError)

Furthermore, when I attempt to setup a new folder for a rails project it comes up with the following:

rails railsproject
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `require'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support.rb:56
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `require'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/bin/../lib/rails_generator.rb:28
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:53:in `require'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/bin/rails:14
  from /usr/bin/rails:19:in `load'
  from /usr/bin/rails:19

Which directory should I have installed the ruby and rubygems folders into? Also, do I need to be in a specific directory for the ruby script/console command to work properly?

This is very frustrating - as I tried to uninstall and reinstall ruby and rubgygems multiple times...

Complete newbie with this - any help would be greatly appreciated!

Cheers Rick

Upvotes: 1

Views: 274

Answers (2)

NilsHaldenwang
NilsHaldenwang

Reputation: 3657

My advice would be to remove all existing packages and use the Ruby Version Manager instead. Just visit the page follow the installation instructions and everything will be fine.

Upvotes: 4

Dty
Dty

Reputation: 12273

Pragmatic Studio has some instructions for ruby 1.9 and rails 3. These are the directions they give students before participating in one of their courses. Pragmatic Studio also publishes a lot of great ruby/rails books so you could say they're a trusted resource.

Upvotes: 0

Related Questions