gem cleanup and rails 1.2.6 problem

I've updated rails and other gems following: http://wiki.rubyonrails.org/rails/pages/HowtoUpgrade
When I try to run: gem cleanup, I get the following error:

Cleaning up installed gems...
Attempting to uninstall rails-1.2.6
ERROR: While executing gem ... (Gem::InstallError)
    Unknown gem rails = 1.2.6

Googling the problem, I found: http://www.ruby-forum.com/topic/170342
Running:
gem uninstall --install-dir -/System/Library/Frameworks/Ruby.framework/
Versions/1.8/usr/lib/ruby/gems/1.8 rails

I get:
ERROR: While executing gem ... (Gem::InstallError)
    Unknown gem rails >= 0

How can I uninstall rails 1.2.6? also, since gem cleanup gets an
error, I can't clean up any other gems....

Elle

Become root, and then do it this way:

gem uninstall --install-dir /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 rails

HTH

Charles

Running it with sudo I get:

ERROR: While executing gem ... (Gem::InstallError)
    Unknown gem rails >= 0

Do I need to actually sign in as root?

Cheers,
Elle

You should be OK with sudo. Can you post your exact command line, and the output from gem list -d rails

HTH

Charles

gem list -d rails gives me:

*** LOCAL GEMS ***

rails (2.2.2, 1.2.6)
    Author: David Heinemeier Hansson
    Rubyforge: http://rubyforge.org/projects/rails
    Homepage: http://www.rubyonrails.org
    Installed at (2.2.2): /Library/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.

Then running:
sudo gem uninstall --install-dir -/System/Library/Frameworks/
Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 rails
gives me:

ERROR: While executing gem ... (Gem::InstallError)
    Unknown gem rails >= 0

Elle

The problem is with your path. You want /System/Library…

but you are doing -/System/Library…

See the difference?

Cheers–

Charles

Ah...this is a good topic.
I'm new to Ruby while using the Mac. So it seems that Mac's installed
Ruby can be uninstalled properly as well. Then we can definitely
update it to get the latest version.

Thanks Charles.

Sorry for the late reply -- for some reason missed your post till now.
Running the command with the correct path and sudo, asks me if I want
to remove executables: rails in addition to the gem? [Yn]
When I say y, I get an error:
ERROR: While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /System/Library/
Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/bin
directory.

Should I sign in as root?

Cheers,
Elle

Yes, please sign in as root, and be sure you get the path right: is starts /System… but not -/System…

Signed in as root and made sure I have the correct path and the same
happens. It asks if I want to uninstall rails. I say yes and it gives
me an error:
ERROR: While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /System/Library/
Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/bin
directory.

Why is this happening? What should I do?

Thanks,
Elle

Log in as root, and go to /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/bin

and post the owner, group and permissions on one of the files. Also post the output of “whoami” command.

Thanks.

Charles

Logged as root, went to /System/Library/Frameworks/Ruby.framework/
Versions/1.8/usr/lib/ruby/gems/1.8
Running
% whoami
gives me:
root

Then running
% ls -l
gives me:
total 8
drwxr-xr-x 31 root wheel 1054 31 Oct 16:51 cache
drwxr-xr-x 32 root wheel 1088 31 Oct 16:51 doc
drwxr-xr-x 31 root wheel 1054 31 Oct 16:51 gems
-rw-r--r-- 1 root wheel 4 5 Jan 2008 source_cache
drwxr-xr-x 31 root wheel 1054 31 Oct 16:51 specifications

Thanks,
Elle