I was having trouble installing ruby 1.9.3-p194 from ruby 1.8.7 on my mac osx 10.7.4.

I have was trying to fix my homebrew after running "brew doctor" and got the message of "/usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. The following tools exist at both paths: c++-4.2 cpp-4.2 erb g++-4.2 gcc-4.2 gcov-4.2 gem i686-apple-darwin11-cpp-4.2.1 i686-apple-darwin11-g++-4.2.1 i686-apple-darwin11-gcc-4.2.1 irb rake rdoc ri ruby testrb"

I fixed it by entering the following, which I found on another stackoverflow answer:

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

Lo and behold! when I typed that ruby updates to 1.9.3-p194. Ruby files seem to compile and run just fine.

However, afterward, my navigation around terminal is messed up severely. For instance I can't do the command "open example_file.html" and have the file pop up in Chrome, instead I get the error: "-bash: open: command not found"

Also, when I change directory, I get an error, inputting "$ cd desktop" yields the output, "-bash: dirname: command not found"

but the directory does then changes... strange.

When I exit out of a terminal window all this resets. I'm back to Ruby 1.8.7, have to use the PATH command again to update to 1.9.3, command line navigation gets broken again.

Any guidance on how to remedy so I can use 1.9.3-p194 and also have normal terminal navigation would be greatly appreciated.

1 Answer 1


Paths are separated by colons. You're missing a colon before $PATH in your export. Due to this your previous paths won't get concatenated properly, making open, etc unavailable. The simple fix -

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

  • That worked, thanks! One slight issue though, every time I exit terminal, I have to redo this change, how can I make it permanent?
    – R V
    Commented Oct 11, 2012 at 17:50
  • To make it permanent you should put this into the .bash_profile file in your home directory. If you use zsh, that'd be .zshrc file in the same place. Also, files beginning with a dot are usually hidden. Commented Oct 12, 2012 at 1:50

You must log in to answer this question.