[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

uninstalling the mac tiger version of ruby

libsfan01

1/21/2007 1:55:00 PM

hi all



in trying to uninstall the mac version of ruby how can i do this?

13 Answers

libsfan01

1/21/2007 2:05:00 PM

0

My reason for wanting to uninstall is that ive tried to install the
latest version but terminal is still telling me that the version is
1.8.2 not 1.8.5 that i downloaded, so it must have gotten messed up
somewhere right?


libsfan01 wrote:
> hi all
>
>
>
> in trying to uninstall the mac version of ruby how can i do this?

Gene Tani

1/21/2007 2:29:00 PM

0


libsfan01 wrote:
> My reason for wanting to uninstall is that ive tried to install the
> latest version but terminal is still telling me that the version is
> 1.8.2 not 1.8.5 that i downloaded, so it must have gotten messed up
> somewhere right?
>
>

There's been numbers of posts on installing Rails from Locomotive,
darwinport/Macports or source recently:

http://blog.nanorails.com/articles/2006/07/11/installing-rails-on-mac-...
http://blog.nanorails.com/articles/2006/10/17/installing-rails-on-mac-os-x-ti...
http://www.sitening.com/blog/2006/05/21/ruby-on-rails-with-o...

http://www.slashdotdash.net/articles/2006/11/10/apple-macbook-pro-setup-for-a-r...
http://blog.pjkh.com/2007/1/15/building-rails-and-all-its-frie...
http://mandhro.com/2006/06/16/setting-up-intel-mac-for-rails-de...

http://blog.labratz.net/articles/2006/10/14/a-shell-script-to-install-the-whole-rails-stack-rmagick-librar...

I forget which one i followed. You don't hear too much about fink
these days. And i don't know about the factory-installed ruby, but
there's stern warnings in my OS X books abotu not uninstalling the
factory-installed perl and python.


Gavin Kistner

1/21/2007 3:02:00 PM

0

libsfan01 wrote:
> My reason for wanting to uninstall is that ive tried to install the
> latest version but terminal is still telling me that the version is
> 1.8.2 not 1.8.5 that i downloaded, so it must have gotten messed up
> somewhere right?

Probably your PATH environment variable is set to use the
tiger-installed version, instead of your new version. Observe:

slim:~ gavinkistner$ /usr/bin/ruby -v
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]

slim:~ gavinkistner$ /usr/local/bin/ruby -v
ruby 1.8.5 (2006-08-25) [powerpc-darwin8.7.0]

slim:~ gavinkistner$ env
[...snip...]
PATH=.:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin
[...snip...]

slim:~ gavinkistner$ which ruby
/usr/local/bin/ruby

In other words, Apple's build lives in /usr/bin, my latest stable build
lives in /usr/local/bin. If I just type "ruby", the PATH environment
variable chooses which directories to look in, and the order to look.
IIRC had to change my PATH to put my local bin directory before
/usr/bin, because I always wanted programs that I had built and
installed to supercede existing installs.

If you really want, you can go in as root and rename /usr/bin/ruby (and
irb and rdoc and others) to have a different name, like ruby182. Or you
could delete them, and hope that nothing relied on them. But I'd just
go with the PATH solution.

Tim Hunter

1/21/2007 3:09:00 PM

0

libsfan01 wrote:
> My reason for wanting to uninstall is that ive tried to install the
> latest version but terminal is still telling me that the version is
> 1.8.2 not 1.8.5 that i downloaded, so it must have gotten messed up
> somewhere right?
>
>
> libsfan01 wrote:
>
>> hi all
>>
>>
>>
>> in trying to uninstall the mac version of ruby how can i do this?
>>
>
>
>
No, don't uninstall the version of Ruby that comes with OS X. That
version is installed in the /usr/bin directory. When you installed Ruby
yourself, you probably installed it (assuming you built it from source
and took the defaults) in /usr/local/bin. All you have to do is make
sure your $PATH variable has /usr/local/bin preceding /usr/bin. When you
execute the "ruby" command OS X will search the directories in the order
listed by $PATH and will find your ruby in /usr/local/bin.

Check it out like this. Enter this command:

/usr/bin/ruby -v

You'll probably get "ruby 1.8.2". Then enter:

/usr/local/bin/ruby -v

You'll probably get "ruby 1.8.5"

Of course, if you specified another prefix when you ran the configure
script, or if you installed Ruby from MacPorts or fink, then Ruby is
installed in a different directory.

For more information about PATH, do a "man bash" in an OS X terminal window.

libsfan01

1/21/2007 5:43:00 PM

0


>
> You'll probably get "ruby 1.8.5"
>

Yes it seems to be the case that its looking for the wrong version.
timothy how can i change the setting of the path variable so that the
latest version is accessed? (from "usr/bin/ruby" to
"usr/local/bin/ruby")?

thanks

marc

libsfan01

1/21/2007 5:43:00 PM

0


>
> You'll probably get "ruby 1.8.5"
>

Yes it seems to be the case that its looking for the wrong version.
timothy how can i change the setting of the path variable so that the
latest version is accessed? (from "usr/bin/ruby" to
"usr/local/bin/ruby")?

thanks

marc

Tim Hunter

1/21/2007 6:27:00 PM

0

libsfan01 wrote:
>> You'll probably get "ruby 1.8.5"
>>
>>
>
> Yes it seems to be the case that its looking for the wrong version.
> timothy how can i change the setting of the path variable so that the
> latest version is accessed? (from "usr/bin/ruby" to
> "usr/local/bin/ruby")?
>
> thanks
>
> marc
>
>

PATH is an environment variable that the bash shell uses when it
searches for a command. In bash you set environment variables like this:

export VAR=value

Notice there's no leading $ in the name when it's on the left-hand side
of the assignment. When you want to get the value of an environment
variable you precede its name with a $. Now, you want to prepend
/usr/local/bin to the current value of PATH. Enter this command:

echo $PATH

This will show you the current value of PATH. Then enter:

export PATH=/usr/local/bin:$PATH

(Directories in the PATH are separated by colons.) issue "echo $PATH"
again to ensure that the change worked.

Now enter "ruby -v". You should see "ruby 1.8.5" because OS X found ruby
in /usr/local/bin.

Of course you don't want to have to redefine your PATH variable every
time you open a terminal. To get your PATH set the way you want it every
time you can add this command to a bash configuration script. The bash
shell gets its configuration from a number of scripts. I believe the
preferred one for this sort of thing is .bash_profile. The bash shell
looks for this file in your home directory. You may already have such a
file. If so, save a backup copy, open it in a text editor and add the
command on a separate line. If the file doesn't already exist, create it
and add these two lines:

#! /bin/bash
export PATH=/usr/local/bin:$PATH

Save the file, close the terminal window and open a new one. Issue "echo
$PATH" again to see your changed PATH. Issue "ruby -v" and ensure that
you're getting "ruby 1.8.5".

Warning: be careful. If you screw up your path many things in OS X will
stop working. If you encounter problems (like commands not working) just
delete your .bash_profile (or restore it to its previous state) and try
again. Always close the terminal window and open a new window after
making a change.

For more info search for bash on the web or issue the "man bash" command
in a terminal window.

Aaron Massey

9/20/2007 7:49:00 PM

0

I have a similar problem. I installed a manually compiled version of
ruby, rails and gem at /usr/local/bin. They all work fine and I have my
environment variables setup so that I can use them in a Terminal without
problems. However, when I start WEBrick, it is defaulting to the Mac OS
X version of rails. Where can I set the version of ruby that WEBrick
should be using?

Thanks in advance!
--
Posted via http://www.ruby-....

John Joyce

9/20/2007 9:58:00 PM

0

I posted something about it on my blog recently, after a recent OS X
update screwed up my $PATH
That's something you need to spend the time looking into.
The one-click installer may or may not replace the old Ruby, but the
Hivelogic install directions will get you what you want.
Don't worry though, only 1 more likely update to OS X 10.4 (10.4.11)
and 10.5 will be out with a working Ruby.
You should install the mongrel gem though. It makes a much more
responsive test server with the built in apache. (and you don't have
to turn apache off to use it, and most hosts providing shell access
and ruby/rails will be on apache anyway.
The book Rails Solutions, from Friends of ED, has an excellent
install/setup for Ruby and Rails in it.

Aaron Massey

9/21/2007 12:05:00 AM

0

Thanks for the responses! Obviously, removing the Apple installation of
ruby and replacing it with simlinks works.

I ended up installing mongrel and using that to solve the problem though
if only because I don't like blowing away files that Apple might simply
replace in future updates.

I did want to point out that the other recommendation I received does
not work. It was actually what I did when I originally installed ruby
manually, so perhaps it is useful to post a sample session that shows
the problem more clearly:

/* my local install ruby is first in my path */
bash $ which ruby
/usr/local/bin/ruby

/* note the versions of my manual install and of the default */
bash $ /usr/local/bin/ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [powerpc-darwin8.10.0]
bash $ /usr/bin/ruby -v
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]

/* see which one WEBrick is picking? */
bash $ ./script/server
=> Booting WEBrick...
=> Rails application started on http://0....
=> Ctrl-C to shutdown server; call with --help for options
[2007-09-20 19:37:03] INFO WEBrick 1.3.1
[2007-09-20 19:37:03] INFO ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
[2007-09-20 19:37:03] INFO WEBrick::HTTPServer#start: pid=795 port=3000


For some reason, even though I have /usr/local/bin listed first in my
path (as Hivelogic suggests in their manual install instructions) the
WEBrick server still uses the Apple default ruby installation. It could
be a weirdness with the way Apple sets up their default $PATH variable
or it could be that WEBrick simply ignores local environment variables.

I can't determine which is the case because I really don't know much
about WEBrick and I can't find where OS X sets up its default
environment variables. (Though, I would like to know if anyone knows
off the top of their head...)

If it is a problem with WEBrick, I would be willing to file a bug or
whatever to help the developers. Obviously, I would like to confirm it
before wasting their time. I guess it's kind of a simple bug, but this
is the sort of thing that looks like it would have high visibility with
new rails developers on Mac OS X. Maybe it only shows up as a problem
until Apple releases their next OS, but there could be folks stuck on OS
X 10.4.x for a while afterwards that might run into this. It could also
manifest later in some form.

It is perhaps useful to point out that because I've also installed gem
in the following location:


bash $ which gem
/usr/local/bin/gem


As a result, anything I install via gem is ignored by WEBrick. For
example, trying to start up a rails app with an sqlite3 database (which
uses the sqlite3 plugin I've installed via gem) provides an error
message:


bash $ gem list --local sqlite3

*** LOCAL GEMS ***

sqlite3-ruby (1.2.1)
SQLite3/Ruby is a module to allow Ruby scripts to interface with a
SQLite3 database.
bash $ ./script/server
=> Booting WEBrick...
=> Rails application started on http://0....
=> Ctrl-C to shutdown server; call with --help for options
[2007-09-20 19:44:13] INFO WEBrick 1.3.1
[2007-09-20 19:44:13] INFO ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
[2007-09-20 19:44:13] INFO WEBrick::HTTPServer#start: pid=799 port=3000

===+ WEB BROWSER ERROR MESSAGE +===
No such file to load -- sqlite3
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
===+ TRUNCATED FOR CLARITY +===


Anyhow, because mongrel is installed via a gem, it seems to recognize
the other gems installed on the system, so I'm going to use that for
now. However, it does seem that the only fully functional recourse in
some cases appears to be actually blowing away the Apple install of
ruby.

Thanks again for the help!
--
Posted via http://www.ruby-....