I recently migrated my shell over to zsh from bash on my os x computer. I obtained zsh from macports, updated my default shell on os x, and restarted. When I tried to use port both shells said they couldn't find port.

Adding /opt/local/bin to both of their paths fixed this issue (which is interested because bash's path never included /opt/local/bin yet those programs always worked). However, the problem that still persists is programs I've installed over macports no longer work. For example: issuing emacs --version gives version 22 instead of version 24 which I installed over macports.

Does anyone know what could have happened and how I could fix this?

  • 1
    How did you add the path? Does which -a emacs show you both versions? – slhck May 16 '13 at 21:52

The easiest solution to this is to start bash, call echo $PATH on it, and then inspect what it contains. Perhaps you never added anything to bash's path yourself, but /etc/profile or even ~/.profile are doing that.

Notice that the directory order in your $PATH matters. If there are 2 emacs installed, the first one found will be picked up. If which -a emacs returns multiple locations, you already have all paths you need, but you probably just placed at the end of $PATH. You should place it in the beginning.

  • This was exactly my problem. I had PATH=$PATH:/opt/local/bin when I wanted PATH=/opt/local/bin:$PATH. So it was finding the out of date version of emacs first. Thank you. – David May 19 '13 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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