Forum: Ruby can't get my Mac OSX UNIX to run 1.8

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
27488cf268f9d2b6f497bc3a240e92bc?d=identicon&s=25 superN00b (Guest)
on 2006-03-06 03:43
Hey guys! This is my first post here, and I've never studied computers
formally, so this is probably going to sound like a stupid question.  I
installed Ruby 1.8 using Terminal on Mac OSX (Thank God for Visual
Quickstart Guides). But when I check the version with "ruby -v", it
still says that it's running version 1.6.2 or whatever. So I went
looking for it and sure enough, the new version didn't overwrite the old
one - it just set tself up next to it. So the shell just keeps on using
the old one.

I don't know what to do - do i just erase the old one and hope that the
shell starts using the new one instead? Or is there some kind of setting
i have to mess with?

Thanks in advance.
9358cc96c46055cd68d4a76a9aefe026?d=identicon&s=25 Daniel Harple (Guest)
on 2006-03-06 04:01
(Received via mailing list)
On Mar 6, 2006, at 3:44 AM, superN00b wrote:
> I installed Ruby 1.8 using Terminal on Mac OSX (Thank God for Visual
> Quickstart Guides). But when I check the version with "ruby -v", it
> still says that it's running version 1.6.2 or whatever. So I went
> looking for it and sure enough, the new version didn't overwrite
> the old
> one - it just set tself up next to it. So the shell just keeps on
> using
> the old one.

I think by default ruby will be installed in /usr/local. The Apple
supplied Ruby is in /usr, and you should not remove it, or overwrite
it. Try setting your PATH variable to include /usr/local/bin first:

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

But for the long-term, you really should consider using DarwinPorts.
It takes the pain out of installing software from source.

-- Daniel
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-03-06 04:04
(Received via mailing list)
On Mar 5, 2006, at 9:44 PM, superN00b wrote:

> the old one.
> Posted via http://www.ruby-forum.com/.
>

Assuming that ruby is installed in /usr/local have your .login file
or .bashrc  have the following line:

PATH=/usr/local/bin:$PATH
37a3c73ffbf864e4b28f7f2384ee12ce?d=identicon&s=25 Timothy Hunter (tim-hunter)
on 2006-03-06 04:04
(Received via mailing list)
superN00b wrote:
> shell starts using the new one instead? Or is there some kind of setting
> i have to mess with?
>
> Thanks in advance.
>

The version of Ruby that comes with OS X is installed in /usr/bin. The
version you installed is (probably) in /usr/local/bin. You can confirm
this by typing

which ruby

Anyway, all you need to do you change your $PATH environment variable to
make /usr/local/bin precede /usr/bin. If you don't know how to do this,
read the "bash" man page about the PATH environment variable. (See the
INVOKATION section.)
27488cf268f9d2b6f497bc3a240e92bc?d=identicon&s=25 superN00b (Guest)
on 2006-03-06 04:37
> Anyway, all you need to do you change your $PATH environment variable to
> make /usr/local/bin precede /usr/bin. If you don't know how to do this,
> read the "bash" man page about the PATH environment variable. (See the
> INVOKATION section.)

OK. I looked it up, but all i found was this description:

PATH   The search path for commands.  It is a colon-separated  list  of
              directories  in  which the shell looks for commands (see
COMMAND
              EXECUTION below).  The default path is system-dependent,
and  is
              set  by  the administrator who installs bash.  A common
value is
              ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.''.

So I know what it is, but where does it live? Do I change it with vi? Is
it a text file or part of a text file? Sorry, I really have zero idea
what I'm doing.
27488cf268f9d2b6f497bc3a240e92bc?d=identicon&s=25 superN00b (Guest)
on 2006-03-06 04:39
Logan Capaldo wrote:
> On Mar 5, 2006, at 9:44 PM, superN00b wrote:
>
>> the old one.
>> Posted via http://www.ruby-forum.com/.
>>
>
> Assuming that ruby is installed in /usr/local have your .login file
> or .bashrc  have the following line:
>
> PATH=/usr/local/bin:$PATH

Sorry! Where can I find these files? I can change them with vi, right?
F0b14b7dbae1e90259eb946d1c841a17?d=identicon&s=25 Ken Collins (Guest)
on 2006-03-06 04:43
(Received via mailing list)
I like to use TextMate (www.macromates.com) and simply just save
a file in your home directory called .bash_profile

You would add something like this too it.

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

But honestly, I thought /usr/local/bin was part of the default path,
and ahh, I see below it is. Do you know where you installed ruby? If
so, that it what you would put in your $PATH environment. BTW, if you
do install DarwinPorts (which is a nice idea) then you will do
something like this in your .bash_profile

export PATH="/opt/local/bin:$PATH"
export MANPATH="/opt/local/share/man:$MANPATH"
export INFOPATH="/opt/local/share/info:$INFOPATH"
27488cf268f9d2b6f497bc3a240e92bc?d=identicon&s=25 superN00b (Guest)
on 2006-03-06 04:47
Daniel Harple wrote:
> On Mar 6, 2006, at 3:44 AM, superN00b wrote:
>> I installed Ruby 1.8 using Terminal on Mac OSX (Thank God for Visual
>> Quickstart Guides). But when I check the version with "ruby -v", it
>> still says that it's running version 1.6.2 or whatever. So I went
>> looking for it and sure enough, the new version didn't overwrite
>> the old
>> one - it just set tself up next to it. So the shell just keeps on
>> using
>> the old one.
>
> I think by default ruby will be installed in /usr/local. The Apple
> supplied Ruby is in /usr, and you should not remove it, or overwrite
> it. Try setting your PATH variable to include /usr/local/bin first:
>
> Bash:
> export PATH=/usr/local/bin:$PATH
>
> But for the long-term, you really should consider using DarwinPorts.
> It takes the pain out of installing software from source.
>
> -- Daniel

OK. That seemed to work.  I thought "Bash" was a command, so it wasn't
working at first, but then I just took it off and typed in from "export"
and it worked. Thanks!
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-03-06 04:52
(Received via mailing list)
On Mar 5, 2006, at 10:39 PM, superN00b wrote:

>> PATH=/usr/local/bin:$PATH
>
> Sorry! Where can I find these files? I can change them with vi, right?
>
> --
> Posted via http://www.ruby-forum.com/.
>

You can change them with vi.  if your shell is bash you need to add
the above line
to the end of one of the following files;
~/.bashrc
~/.bash_login
~/.bash_profile
~/.profile

I would suggest ~/.bashrc

So at your shell prompt type:
vi ~/.bashrc
and add the lines:
PATH=/usr/local/bin:$PATH
export PATH

to the end of  this file. You will need to open a new terminal window
for these changes to take effect. Then to be sure it worked type:
ruby -v
And hopefully you should see the 1.8 version of ruby
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-03-06 04:55
(Received via mailing list)
On Mar 5, 2006, at 10:43 PM, Ken Collins wrote:

> But honestly, I thought /usr/local/bin was part of the default
> path, and ahh, I see below it is.

I don't believe it is actually, I don't have a default .bash_profile
(or .profile, etc. I like zsh) and if I cat /etc/profile and /etc/
bashrc:

% cat /etc/profile
# System-wide .profile for sh(1)

PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export PATH

if [ "${BASH-no}" != "no" ]; then
         [ -r /etc/bashrc ] && . /etc/bashrc
fi
## TeX modifications start at Tue Feb 14 15:11:35 EST 2006
## Do not remove the previous line
if [ `whoami` != "root" ]
then
   PATH="$PATH:/usr/local/teTeX/bin/powerpc-apple-darwin-current"
   export PATH
fi
## Do not remove the next line
## TeX modifications end at Tue Feb 14 15:11:35 EST 2006


% cat /etc/bashrc
# System-wide .bashrc file for interactive bash(1) shells.
if [ -n "$PS1" ]; then PS1='\h:\w \u\$ '; fi
# Make bash check it's window size after a process completes
shopt -s checkwinsize


I also note that i-Installer has decided to invade the system wide /
etc/profile. That's a bad i-Installer! No cookie!
9dfe8c734b0f9b37a4e218425c0a2138?d=identicon&s=25 Gene Tani (Guest)
on 2006-03-06 07:35
(Received via mailing list)
superN00b wrote:
> > PATH=/usr/local/bin:$PATH
>
> Sorry! Where can I find these files? I can change them with vi, right?
>
> --

You should feel free to ask as many questions as you like to this list,
but you'll also need some unix-y background info, so I recommend the 2
Missing manuals, the "Learnign unix for Tiger" and  maybe "Tiger for
Unix geeks" if you really get into it.  All excellent books.

http://www.oreilly.com/pub/topic/mac

Also might want to look at darwin and fink for installing other
packages (as an alternative to tarballs, i.e. .tgz or .tar.gz files:

http://pdb.finkproject.org/pdb/section.php/languages
http://darwinports.opendarwin.org/
This topic is locked and can not be replied to.