oh-my-zsh is a beautiful framework for zsh shell in a Unix platform. As they said, it will beautifully upgrade your experience in using the shell with many-many functionality including auto complete command for popular package such as Git, php, etc.

But there is one caveat in using this shell rather than the default bash shell. The .bash_profile File! I mean that I spent hours of scratching my head to find what is wrong with my $PATH configuration that even though I am updating the php to version 5.6, yet when I try to check it in terminal by typing php -v, the return is always 5.5.31.

OK. so the journey to my self enlightenment moment began with a tracing session.

  1. Type  which php in terminal, returns /usr/bin/php
  2. I check the path, by typing echo $PATH returns the path that not a single one mentioning the exporting path from /usr/bin/php, but there is one suspicion that the export path pointing to php is from another location /Application/MAMP/bin/php5.5.3
  3. Open up both ~/.bash_profile and ~/.profile file. Looks good but there is still no text path to /usr/bin/php, let alone MAMP php. Instead, my php installation export in bash_profile pointing to /usr/local/php5/bin/php. Hmmm. Suspicion intensifies… It means this bash_profile never executed by the system, and it using the profile I am not recognized what and where…
  4. To test the theory, I execute source ~/.bash_profile. Well, well, look what I’ve just found when I try to php -v. Now it shows I am using php 5.6.27. Yaaay!
  5. Yay? Nayy! Too soon my boy. When I restarted the bash shell, php -v again shows a revert back to version 5.5.31. Should I source bash profile everytime I opened terminal only to have php cli 5.6.27 up and running? What am I? A savage?
  6. Intensive search in google and suspicion of  that there is a relation with I am using a different base bash shell with the missing link of bash profile leads me to the ultimate answer.
  7. turns out the answer is simple. I am using zsh shell, and the executed path is stored in their own profile file called .zshrc. Ok. I opened the file (excuse me newbie, that is by using vi ~/.zshrc and voila! all of the problematic export path is stored here, including the path to /usr/bin/php and even the path to php MAMP one! So, as a goodboy as I am, I deleted all of obsolete paths and… folks, this is the most important part… to reconnect this zsh profile with my default bash, I stored this command at the end of my .zshrc file: you guessed it. yep. the old source ~/.bash_profile. This is to ensure that zsh will executed bash profile, so I would not dirty my hand and export new path to bash_profile instead to zsh everytime there is the need to do that.
  8. Fertig. Go home now. Enjoy your Dinner!