Can't get my Mac OSX UNIX to run 1.8


#1

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.


#2

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


#3

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


#4

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.)


#5

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.


#6

Logan C. 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?


#7

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"


#8

Daniel H. 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!


#9

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


#10

On Mar 5, 2006, at 10:43 PM, Ken C. 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!


#11

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/