Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Oct 12 '12 at 21:05

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

up vote 0 down vote accepted

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"

share|improve this answer
    
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 Oct 11 '12 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. –  Abhishek Mishra Oct 12 '12 at 1:50
add comment

Your Answer

 
discard

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