Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to install ruby/rubygems on the latest version of 10.6. I used MacPorts to install ruby after noticing that my version was old. ruby was installed into /opt/local/bin.

I changed .bash_profile and added:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

When I echo $PATH, I get:


So when I type which ruby I get:


Which works correctly. However, when I type which gem I get:


When using gem -environment I get (gem is in the above directory):

-bash: /usr/bin/gem: No such file or directory

I'm completely open to uninstalling everything and starting over if necessary. I'm just not sure why it's still trying to grab it from /usr/bin!

share|improve this question

2 Answers 2

The default gem is a function and they get called before $PATH and also before the command hash.

Try playing with hash (or clearing it with hash -r ) to see if your path isn't getting a say in which gem to call.

type gem will confirm whether yur gem is really a function...

share|improve this answer

What a mess. I ended up removing all versions of ruby and MacPorts and compiling 1.9.2 from source. Everything is working fine now.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.