16

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
remonses
  • 402
  • 1
  • 4
  • 17
  • i'm getting the same issue, please let me know if this gets answered. Try running ```brew doctor``` and fix all issues and trying again. – Mohammed Jan 14 '18 at 19:23

3 Answers3

24

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.

andrewbfr
  • 356
  • 1
  • 5
  • Thanks andrewbfr, you saved me from updating my OS. – Anukool srivastav Jan 31 '18 at 12:21
  • Hi Andrew, on running `brew install homebrew/versions/mongodb3.0`, I get the following `homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated`. If I continue, on `brew link --force mongodb@3.0`, I again get this error `Error: No such keg: /usr/local/Cellar/mongodb@3.0`. – remonses Feb 15 '18 at 18:40
  • `brew install mongodb@3.0` instead of `brew install homebrew/versions/mongodb30 ` worked for me. – remonses Feb 16 '18 at 03:53
  • Hey @user122121. I had that deprecation notice, too, but it didn't cause me to hang up while installing. Nice job finding the work-around with the updated `brew install `. – andrewbfr Feb 17 '18 at 17:52
5

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.

mokagio
  • 16,391
  • 3
  • 51
  • 58
Wan B.
  • 18,367
  • 4
  • 54
  • 71
  • Since it clearly states that mongodb will work on a full installation of Xcode 8.3 and which is possible only on Sierra, won't I find the same blockage while installing it through MongoDB Download Centre? Is there any way to install an older version of mongodb which will be compatible with my system? – remonses Jan 18 '18 at 09:22
  • 1
    When you install via HomeBrew, by default you're getting the pre-compiled version (called bottle, see [mongodb bottle](https://bintray.com/homebrew/bottles/mongodb#). In order to compile the formula on your local machine HomeBrew requires XCode. If you download from the download center, you're getting the compiled binary versions. The binary versions starting from MongoDB v3.0+ should support macos 10.7+ (Lion). – Wan B. Jan 18 '18 at 21:34
0

You can download mongodb-app from github: https://github.com/gcollazo/mongodbapp

I was able to successfully run mongodb4 with it on my machine, after brew installing failed.

mzoz
  • 1,273
  • 1
  • 14
  • 28