In Mac OS X, you can set the environment variables in one of the following files :

  1. ~/.bashrc
  2. ~/.bash_profile
  3. ~/.profile

By default, Mac OS X does not has above files, you need to create it manually.

$PATH example

This example shows you how to set “mongodb/bin” folder to the existing $PATH environment variable.

$ echo $PATH
$ mongo -version
-bash: mongo: command not found
$cd ~
$touch .bash_profile
$vim .bash_profile
export MONGO_PATH=~/mongodb
##restart your terminal
$ mongo -version
MongoDB shell version: 2.0.7
$ echo $PATH


Tags :
Founder of and, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Related Posts

Popular Posts