Mongodb installation failed with homebrew and Xcode 8.1.1
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 [email protected] [email protected]
[email protected] percona-server-mongodb`
Now:
`$ brew install [email protected]`
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 [email protected]`
This next command is provided after successful completion of the --force
command:
`$ echo 'export PATH="/usr/local/opt/[email protected]/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.
Is there anyway to install mongodb without upgrading it to Mac OS Sierra and Xcode 8.3.3?
Unfortunately in order to install Xcode 8.3+ you are required to be on MacOS Sierra 10.12. See Xcode compatibility requirements in Apple App Store for more information.
An alternative way is to download MongoDB Community edition through MongoDB Download Center, and then follow the Install MongoDB Community Edition on MacOS instruction.