I am running OSX 10.11.6, unable to update to 10.12 because my machine is older (mid-2009 Macbook Pro). While trying to install MongoDB I ran into the error:
`mongodb: A full installation of Xcode.app 8.3.2 is required to compile
this software.
Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
Error: An unsatisfied requirement failed this build.`
I presently have XCode 8.0, which took some other kind of run-around to get anyway. So I needed a compatible MongoDB build. 3.0.6 is compatible.
To install through the command line with Homebrew:
`user$ brew search mongodb`
And receive this answer:
`==> Searching local taps...
mongodb mongodb@3.0 mongodb@3.2
mongodb@3.4 percona-server-mongodb`
Now:
`$ brew install mongodb@3.0`
OK, next I have a note to myself about creating these next directories in my root directory, but I did it in my current User (which has administrative access on the OS). These commands need to be precise and in this order:
`$ sudo mkdir -p /data/db`
(enter your OSX User password when prompted)
`$ sudo chown -R $USER /data/db`
`$ sudo chmod go+w /data/db`
This next one came from another S.O. answer: How to install earlier version of mongodb with homebrew?
`$ brew link --force mongodb@3.0`
This next command is provided after successful completion of the --force
command:
`$ echo 'export PATH="/usr/local/opt/mongodb@3.0/bin:$PATH"' >>
~/.bash_profile`
Now, you can run your Mongo as a Daemon with:
`$ mongod`
It should now be listening on Port 27017, and in another terminal tab you can run $ mongo
and use this tab to enter your Mongo queries and commands. Running it in another tab is important; allowing $ mongod
to sit untouched and monitor traffic is necessary.
Edited: To update brew versions <>
command per @user122121 comment and updated formatting.