Wednesday, November 7, 2012

RockMongo: MongoDB Client on Mac OSX Lion

On Mac OSX Lion, I use MongoHub as the client tool to view and display my mongodb. MongoHub has native UI for Mac, and provided functionalities for most of my operations. However MongoHub is a little bit buggy and sometimes crashes. On my apache server, I use RockMongo, an excellent Mongo administrator site to manage my mongodb. Here is some steps for me to lunch RockMongo on my Mac OSX Lion(10.7). It runs perfectly!


  1. Apache2 and PHP5 has already been installed on Mac OSX. You just need to enable it.
    • Enable Apache2:   
    install apache2 on mac osx
    • PHP is disabled on apache2 by default, you need to enable it manually: open apache2 config file with command "sudo vi /etc/apache2/httpd.conf", find the line "LoadModule php5_module libexec/apache2/libphp5.so" and remove the "#" at the beginning to enable php5 module.
  2. Install mongo php driver
    • You may need to firstly install the php tool "pecl"
      • cd /usr/lib/php
      • sudo php install-pear-nozlib.phar
      • Edit/etc/php.ini and find the line: ;include_path = ".:/php/includes" and change it to:
        include_path = ".:/usr/lib/php/pear"
      • sudo pear channel-update pear.php.net
      • sudo pecl channel-update pecl.php.net
      • sudo pear upgrade-all
    • Then run command "sudo pecl install mongo". Make sure you xcode has been installed correctly. pecl will download mongo php driver source code and build it. (The precompiled mongo.so may not work on your machine. So you have to use pecl to install the driver.)
    • run command sudo vi /etc/php.ini to open php.ini for editing, if you /etc/php.ini does not exist, copy /etc/php.ini.default to /etc/php.ini, add "extension=mongo.so"
  3. Download RockMongo source code, and copy to your "computer website folder"
  4. You need to run "sudo apachectl restart" to restart apache2 server.
  5. Login to http://localhost/rockmongo, with user/password as "admin/admin". Then you should see  RockMongo as follows:

1 comment:

  1. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.
    Regards,
    PHP Training Institute in Chennai

    ReplyDelete