Which RoR to run on Mac OS X for a particular RoR app

Walter D. wrote in post #966917:

On Dec 7, 2010, at 11:20 AM, Rob Th wrote:

I think if you re-image this machine

What is re-image?

Use the OS install disks to wipe the machine blank and re-install your
target OS.
Walter

Ouch, this Mac has a lot more than ruby and rails on it. Cannot do that.
I have a back up of course but what to restore to make sure I get rid of
all rails, there has to be an easier way. If I know which
directories/files to not restore to keep from restoring a version of
rails, I should be able to just delete these directories/files.

I cannot fine documentation as to where on a Mac the rails stuff goes.

On 7 December 2010 17:51, Rob Th [email protected] wrote:

See how complicated this question got. I asked how can I get rid of all
the other versions and simplify my environment and I got more complexity
of rvm.

Correct me if I am wrong but your fundamental problem is that somehow
the rails environment is messed up. Your proposed solution is to
delete it all and start again. No-one seems to know how to do this,
though you do know how to remove individual gems (you did it for rails
2.3.8) so you could do this for each of the gems you do not want. You
still have the problem that somehow
rails -v
does not work so somehow you have lost the rails startup script.

As everyone keeps advising a much better solution is to completely
ignore the current installation and use rvm. You can then install
just the versions of everything that you want within rvm and run your
app within that environment. It appears that you tried that and had
some problems, but why not try again and ask for help here if you run
into problems. It seems to me it is much better than risking the
integrity of your whole machine.

Colin

On Tue, Dec 7, 2010 at 10:06 AM, Colin L. [email protected]
wrote:

Correct me if I am wrong but your fundamental problem is that somehow
the rails environment is messed up. Your proposed solution is to
delete it all and start again. No-one seems to know how to do this,
though you do know how to remove individual gems (you did it for rails
2.3.8) so you could do this for each of the gems you do not want. You
still have the problem that somehow
rails -v
does not work so somehow you have lost the rails startup script.

Uh, “somehow”?? It was deleted when the gem was uninstalled, as a
previous post showed.

Select gem to uninstall:

  1. rails-2.3.8
  2. rails-2.3.8
  3. All versions

3
Remove executables:
rails

in addition to the gem? [Yn]
Removing rails
Successfully uninstalled rails-2.3.8

The easiest thing to do would be sudo gem uninstall rails to get rid
of all the rails versions and then install the one you want.

I would certainly do that before trying to manually remove the gems,
though that’s trivial (use gem env to find where they are and delete).


Hassan S. ------------------------ [email protected]
twitter: @hassan

Hassan S. wrote in post #966940:

On Tue, Dec 7, 2010 at 10:06 AM, Colin L. [email protected]
wrote:

Correct me if I am wrong but your fundamental problem is that somehow
the rails environment is messed up. Your proposed solution is to
delete it all and start again. No-one seems to know how to do this,
though you do know how to remove individual gems (you did it for rails
2.3.8) so you could do this for each of the gems you do not want. You
still have the problem that somehow
rails -v
does not work so somehow you have lost the rails startup script.

Uh, “somehow”?? It was deleted when the gem was uninstalled, as a
previous post showed.

Select gem to uninstall:

  1. rails-2.3.8
  2. rails-2.3.8
  3. All versions

3
Remove executables:
rails

in addition to the gem? [Yn]
Removing rails
Successfully uninstalled rails-2.3.8

The easiest thing to do would be sudo gem uninstall rails to get rid
of all the rails versions and then install the one you want.

I would certainly do that before trying to manually remove the gems,
though that’s trivial (use gem env to find where they are and delete).


Hassan S. ------------------------ [email protected]
twitter: @hassan

I thought uninstalling rails 2.3.8 would uninstall that version then a
different version would be “current”. I paused at that question. I have
to admit.

BTW…
gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.5, 2.2.2, 1.3.6)
actionpack (2.3.5, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.5, 2.2.2, 1.15.6)
activeresource (2.3.5, 2.2.2)
activesupport (2.3.5, 2.2.2, 1.4.4)
acts_as_ferret (0.4.3)
capistrano (2.5.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
dnssd (0.6.0)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
highline (1.5.0)
hpricot (0.6.164)
libxml-ruby (1.1.2)
mongrel (1.1.5)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.1)
net-ssh (2.0.4, 1.1.4)
net-ssh-gateway (1.0.0)
rack (1.0.1)
rails (2.3.5, 2.2.2, 1.2.6)
rake (0.8.3)
RedCloth (4.1.1)
ruby-openid (2.1.2)
ruby-yadis (0.3.4)
rubynode (0.1.5)
rvm (1.1.3)
sqlite3-ruby (1.2.4)
termios (0.9.4)
xmpp4r (0.4)

Looks like several versions of rails are still hanging around!

But…

sudo gem uninstall rails
ERROR: While executing gem … (Gem::InstallError)
cannot uninstall, check gem list -d rails

And…
gem list -d rails

*** LOCAL GEMS ***

rails (2.3.5, 2.2.2, 1.2.6)
Author: David Heinemeier H.
Rubyforge: http://rubyforge.org/projects/rails
Homepage: http://www.rubyonrails.org
Installed at (2.3.5):
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
(2.2.2):
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
(1.2.6):
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

Web-application framework with template engine, control-flow layer,
and ORM.

FYI

So it looks like heading over to
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
and deleting gems/* may do it. In this directory there is an alias to
/Library/Ruby/Site and one to /Library/Ruby/Gems, which has some
interesting content.

So, Mr Schroeder, given this:
gem env
RubyGems Environment:

  • RUBYGEMS VERSION: 1.3.5
  • RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174)
    [universal-darwin10.0]
  • INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
  • RUBY EXECUTABLE:
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  • EXECUTABLE DIRECTORY: /usr/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • universal-darwin-10
  • GEM PATHS:
    • /Library/Ruby/Gems/1.8
    • /Users/rob/.gem/ruby/1.8

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

What do I drag to the trash? Looks like the stuff in the three GEM
PATHS?

Hassan S. wrote in post #966954:

On Tue, Dec 7, 2010 at 11:07 AM, Rob Th [email protected] wrote:

I thought uninstalling rails 2.3.8 would uninstall that version then a
different version would be “current”.

It would have if you’d answered no :slight_smile:

Looks like several versions of rails are still hanging around!

But…

sudo gem uninstall rails
ERROR: While executing gem … (Gem::InstallError)
cannot uninstall, check gem list -d rails

mmm, surprising. What happens if you try explicitly uninstalling e.g.
2.3.5 ? It would be preferable to removing directories willy-nilly, IMO.

If that works, uninstall the others also, then re-install 2.2.2.


Hassan S. ------------------------ [email protected]
twitter: @hassan

gem uninstall rails -v=2.3.5
ERROR: While executing gem … (Gem::InstallError)
cannot uninstall, check gem list -d rails

gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.5, 2.2.2, 1.3.6)
actionpack (2.3.5, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.5, 2.2.2, 1.15.6)
activeresource (2.3.5, 2.2.2)
activesupport (2.3.5, 2.2.2, 1.4.4)
acts_as_ferret (0.4.3)
capistrano (2.5.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
dnssd (0.6.0)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
highline (1.5.0)
hpricot (0.6.164)
libxml-ruby (1.1.2)
mongrel (1.1.5)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.1)
net-ssh (2.0.4, 1.1.4)
net-ssh-gateway (1.0.0)
rack (1.0.1)
rails (2.3.5, 2.2.2, 1.2.6)
rake (0.8.3)
RedCloth (4.1.1)
ruby-openid (2.1.2)
ruby-yadis (0.3.4)
rubynode (0.1.5)
rvm (1.1.3)
sqlite3-ruby (1.2.4)
termios (0.9.4)
xmpp4r (0.4)

On Tue, Dec 7, 2010 at 11:07 AM, Rob Th [email protected] wrote:

I thought uninstalling rails 2.3.8 would uninstall that version then a
different version would be “current”.

It would have if you’d answered no :slight_smile:

Looks like several versions of rails are still hanging around!

But…

sudo gem uninstall rails
ERROR: While executing gem … (Gem::InstallError)
cannot uninstall, check gem list -d rails

mmm, surprising. What happens if you try explicitly uninstalling e.g.
2.3.5 ? It would be preferable to removing directories willy-nilly, IMO.

If that works, uninstall the others also, then re-install 2.2.2.


Hassan S. ------------------------ [email protected]
twitter: @hassan

Even odder.

sudo gem uninstall rails -v 2.3.5
ERROR: While executing gem … (Gem::InstallError)
cannot uninstall, check gem list -d rails
RobsiMac:~ rob$ sudo gem install rails -v 2.3.5
Successfully installed rails-2.3.5
1 gem installed
Installing ri documentation for rails-2.3.5…
Installing RDoc documentation for rails-2.3.5…
RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.5
Successfully uninstalled rails-2.3.5
RobsiMac:~ rob$ rails -v
Rails 2.3.5

Rob Th wrote in post #966961:

Even odder.

sudo gem uninstall rails -v 2.3.5
ERROR: While executing gem … (Gem::InstallError)
cannot uninstall, check gem list -d rails
RobsiMac:~ rob$ sudo gem install rails -v 2.3.5
Successfully installed rails-2.3.5
1 gem installed
Installing ri documentation for rails-2.3.5…
Installing RDoc documentation for rails-2.3.5…
RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.5
Successfully uninstalled rails-2.3.5
RobsiMac:~ rob$ rails -v
Rails 2.3.5

Compare the output of “gem env” and “sudo gem env”.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On Tue, Dec 7, 2010 at 11:39 AM, Rob Th [email protected] wrote:

RobsiMac:~ rob$ sudo gem install rails -v 2.3.5
Successfully installed rails-2.3.5
1 gem installed
RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.5
Successfully uninstalled rails-2.3.5
RobsiMac:~ rob$ rails -v
Rails 2.3.5

So what happens now if you sudo gem uninstall rails ?


Hassan S. ------------------------ [email protected]
twitter: @hassan

Hassan S. wrote in post #966968:

On Tue, Dec 7, 2010 at 11:39 AM, Rob Th [email protected] wrote:

RobsiMac:~ rob$ sudo gem install rails -v 2.3.5
Successfully installed rails-2.3.5
1 gem installed
RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.5
Successfully uninstalled rails-2.3.5
RobsiMac:~ rob$ rails -v
Rails 2.3.5

So what happens now if you sudo gem uninstall rails ?


Hassan S. ------------------------ [email protected]
twitter: @hassan

gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.5, 2.2.2, 1.3.6)
actionpack (2.3.5, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.5, 2.2.2, 1.15.6)
activeresource (2.3.5, 2.2.2)
activesupport (2.3.5, 2.2.2, 1.4.4)
acts_as_ferret (0.4.3)
capistrano (2.5.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
dnssd (0.6.0)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
highline (1.5.0)
hpricot (0.6.164)
libxml-ruby (1.1.2)
mongrel (1.1.5)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.1)
net-ssh (2.0.4, 1.1.4)
net-ssh-gateway (1.0.0)
rack (1.0.1)
rails (2.3.5, 2.2.2, 1.2.6)
rake (0.8.3)
RedCloth (4.1.1)
ruby-openid (2.1.2)
ruby-yadis (0.3.4)
rubynode (0.1.5)
rvm (1.1.3)
sqlite3-ruby (1.2.4)
termios (0.9.4)
xmpp4r (0.4)
RobsiMac:~ rob$ sudo gem uninstall rails

Select gem to uninstall:

  1. rails-2.2.2
  2. rails-2.2.2
  3. All versions

Ouch.

On Tue, Dec 7, 2010 at 12:05 PM, Rob Th [email protected] wrote:

RobsiMac:~ rob$ sudo gem uninstall rails

Select gem to uninstall:

  1. rails-2.2.2
  2. rails-2.2.2
  3. All versions

Ouch.

So select 3 and keep going :slight_smile:

You can always add back the version you want later.


Hassan S. ------------------------ [email protected]
twitter: @hassan

Hassan S. wrote in post #966986:

On Tue, Dec 7, 2010 at 12:05 PM, Rob Th [email protected] wrote:

RobsiMac:~ rob$ sudo gem uninstall rails

Select gem to uninstall:

  1. rails-2.2.2
  2. rails-2.2.2
  3. All versions

Ouch.

So select 3 and keep going :slight_smile:

You can always add back the version you want later.


Hassan S. ------------------------ [email protected]
twitter: @hassan

sudo gem uninstall rails
Password:

Select gem to uninstall:

  1. rails-2.2.2
  2. rails-2.2.2
  3. All versions

3
Remove executables:
rails

in addition to the gem? [Yn] y
Removing rails
Successfully uninstalled rails-2.2.2
Remove executables:
rails

in addition to the gem? [Yn] y
Removing rails
Successfully uninstalled rails-2.2.2
RobsiMac:~ rob$ rails -v
-bash: /usr/bin/rails: No such file or directory
RobsiMac:~ rob$ sudo gem install rails -v 2.2.2
Successfully installed rails-2.2.2
1 gem installed
Installing ri documentation for rails-2.2.2…
Installing RDoc documentation for rails-2.2.2…
RobsiMac:~ rob$ rails -v
Rails 2.3.5

Oh, no. Night of the Living Dead.

Is there a way to run gem in verbose mode to see what is going on?

On 7 December 2010 21:23, Rob Th [email protected] wrote:

RobsiMac:~ rob$ rails -v
Rails 2.3.5

Oh, no. Night of the Living Dead.

I don’t know why you are so worried about other versions of rails that
may be installed. If you look at environment.rb for the app you want
to run you will see it requests a particular version of Rails. Any
other versions installed will be ignored. They are entirely
independent of each other. What you see when you type rails -v is
pretty much irrelevant I think. It is not the version that the app
will use, just the version that will be used if you create a new app
(though even when you create a new app you can specify which version
you want).

Colin

Is there a way to run gem in verbose mode to see what is going on?

maybe gem (un)install your_gem_here -V? The flag -V (that’s the
uppercase letter) tells the command to be ‘verbose’.

OK as a famous fictional lawman once said “a man is got to do what a man
has got to do”, or as we do when a hydro-cylindar pin gets stuck on the
back hoe and we break out the big hammer and torch, I just use the
wonderful “drag to trash” on all the gem folders I could find, installed
sudo gem install rails -v 2.2.2 and look here:

gem list --local

*** LOCAL GEMS ***

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
rails (2.2.2)
rake (0.8.7)

Did a quick rails hello222 and got the whole mess.

script/server and up we go.

script/server
=> Booting WEBrick…
=> Rails 2.2.2 application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2010-12-07 17:10:32] INFO WEBrick 1.3.1
[2010-12-07 17:10:32] INFO ruby 1.8.7 (2009-06-12)
[universal-darwin10.0]
[2010-12-07 17:10:32] INFO WEBrick::HTTPServer#start: pid=67167
port=3000
127.0.0.1 - - [07/Dec/2010:17:11:18 EST] “GET / HTTP/1.1” 200 7385

  • → /
    127.0.0.1 - - [07/Dec/2010:17:11:18 EST] “GET /javascripts/effects.js
    HTTP/1.1” 200 38675
    http://localhost:3000/ → /javascripts/effects.js
    127.0.0.1 - - [07/Dec/2010:17:11:18 EST] “GET /javascripts/prototype.js
    HTTP/1.1” 200 129738
    http://localhost:3000/ → /javascripts/prototype.js
    127.0.0.1 - - [07/Dec/2010:17:11:18 EST] “GET /images/rails.png
    HTTP/1.1” 200 6646
    http://localhost:3000/ → /images/rails.png
    127.0.0.1 - - [07/Dec/2010:17:11:18 EST] “GET /favicon.ico HTTP/1.1” 200
    0
    http://localhost:3000/ → /favicon.ico
    127.0.0.1 - - [07/Dec/2010:17:11:21 EST] “GET /rails/info/properties
    HTTP/1.1” 500 15464
    http://localhost:3000/ → /rails/info/properties

Woohoo. Who said RoR is oblique??

localhost:3000 is responding.

One remaining glitch.

"About your application’s environment:

MissingSourceFile in Rails/infoController#properties

no such file to load – sqlite3
RAILS_ROOT: /Users/rob/hello222

Is this a missing sqlite gem?

Shoot. What the heck is this

sudo gem install sqlite3-ruby -v 1.2.4
Password:
Building native extensions. This could take a while…
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb
mkmf.rb can’t find header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Gem files will remain installed in
/Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to
/Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out
RobsiMac:~ rob$

One remaining glitch.

"About your applications environment:

MissingSourceFile in Rails/infoController#properties

no such file to load – sqlite3
RAILS_ROOT: /Users/rob/hello222

Is this a missing sqlite gem?

I believe it could be. Try loading the gem and see what happens, you
can always remove it. Is your application using sqlite as a DB?

That probably means that you need a C compiler or DevKit so the
install command can build the gem.