Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongodb installation failed with homebrew and Xcode 8.1.1

On running brew install mongodb, I get the following output:

Updating Homebrew...
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.

My system is running on OSX El Capitan version 10.11.6.

Is there anyway to install mongodb without upgrading it to Mac OS Sierra and Xcode 8.3.3?

like image 720
remonses Avatar asked Jan 14 '18 15:01

remonses


People also ask

Does MongoDB need Xcode?

`mongodb: A full installation of Xcode. app 8.3. 2 is required to compile this software.


2 Answers

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.

like image 107
andrewbfr Avatar answered Nov 18 '22 20:11

andrewbfr


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.

like image 5
Wan Bachtiar Avatar answered Nov 18 '22 19:11

Wan Bachtiar