This is based on https://github.com/codeforamerica/ohana-api/wiki/Installing-MongoDB-with-MacPorts-on-OS-X
the macports version of MongoDB does not come pre-configured and will not run after installing until you change some settings. The instructions linked above describe a way to fix this but they ignore the fact that many of the directories are already created and owned by the user "_mongo". It also runs the daemon as root rather than _mongo. Below is a modified approach that uses the _mongo user and avoids creating unnecessary directories.
- Install mongodb with
sudo port install mongodb
(you probably want to start with asudo port selfupdate
) - Create configuration directory with
sudo mkdir /opt/local/etc/mongodb/
- Create configuration file with
sudo pico /opt/local/etc/mongodb/mongod.conf