So I recently started using OSX and I have been struggling with all the commands around. I tried to install MongoDB about 10 hours before finally getting how to do it. So here is short how I did it.
1. Install homebrew http://brew.sh/
2. brew install mongodb
3. brew install autoconf
4. brew install php56 //This is optional I think
5. brew install openssl
6. brew link openssl --force
7. Install PEAR and PECL http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/
7. sudo pecl install mongo
8. locate your php ini which is loaded. php --ini (Loaded Configuration File: /usr/local/etc/php/5.6/php.ini)
9. add line extension=mongo.so somewhere in the file
10. Edit file /etc/apache2/httpd.conf and add line LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so (this points to the installed php version)
11. sudo apachectl restart
12. create php.info file and check that you see mongodb installed.