02 November 2015

setup

  1. with homebrew

    1. update homebrew’s package database

       $ sudo brew update
      
    2. install mongodb

       # 1. install mongodb binaries
       $ brew install mongodb
       ==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.0.7.el_capitan.bottle.tar.gz
           ######################################################################## 100.0%
       ==> Pouring mongodb-3.0.7.el_capitan.bottle.tar.gz
       ==> Caveats
       To have launchd start mongodb at login:
         ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
       Then to load mongodb now:
         launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
       Or, if you don't want/need launchctl, you can just run:
         mongod --config /usr/local/etc/mongod.conf
       ==> Summary
       🍺  /usr/local/Cellar/mongodb/3.0.7: 17 files, 158M
      
       # 2. build mongodb from source with TLS/SSL support
       $ brew install mongodb --with-openssl
      
       # 3. install the latest development release
       $ brew install mongodb --devel
      
  2. manually

    1. download

       $ curl -O https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.0.7.tgz
      
    2. extract

       $ tar -zxf mongodb-osx*.tgz
      
    3. copy to target directory

       $ mkdir -p /usr/local/mongodb
       $ cp -R -n mongodb-osx-x86_64-3.0.7/ /usr/local/mongodb
      
    4. put binaries in the PATH variable

       $ export PATH=/usr/local/mongodb/bin:$PATH
      

run mongodb

  1. steps

    1. create the data directory

       # default the `mongod` process uses the `/data/db` directory
       $ mkdir -p /data/db
      
    2. set permissions

       # ensure that user account running `mongod`
       # has read & write permissions for the directory
      
    3. run mongodb

       $ mongod
       $ /usr/local/mongodb/bin/mongod
       $ mongod --dbpath /data/db
      
    4. stop mongodb

       $ ^+c
      


blog comments powered by Disqus