1

Possible Duplicate:
What are PATH and other environment variables, and how can I set or use them?

I have the default package of Ruby installed that shipped with the OS, which is an older version.

I have recently installed MacPorts with the latest Ruby version which is installed in a seperate location:-

/opt/local/bin/

But when I run

which ruby

I get

/usr/bin/ruby

Is there any way to edit the path of the command ruby so it would reference the new installation in the /opt/ directory?

Thanks in advance.

0

2 Answers 2

3

You have to put /opt/local/bin before /usr/bin in your $PATH and maybe clear your command cache with hash -r.

1

Well since Mac is based on Unix its a simple command Editing your config file.

you can try that

~/.bash_profile (Local Profile) or
~/.MacOSX/environment.plist (System Wide)
export PATH=/opt/local/bin:$PATH

or you can use an alias however the which command wont work with these.

alias ruby=/opt/local/bin/ruby 

Hope this helps, Here is a link for more information effectively you are looking to set an environment variable.

Not the answer you're looking for? Browse other questions tagged .