29

To reiterate, I'm running the first OS X 10.10 beta, and attempting to reinstall MongoDB with Homebrew.

After running $ brew install mongodb, this is the output:

==> Downloading http://downloads.mongodb.org/src/mongodb-src-r2.6.1.tar.gz
==> /usr/local/opt/scons/bin/scons install --prefix=/usr/local/Cellar/mongodb/2.6.1 -j8 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ --osx-version-min=10.10 --full --64
scons: Reading SConscript files ...
Mkdir(".scons/Darwin/nohost")
usage: scons [OPTION] [TARGET] ...

SCons Error: option --osx-version-min: invalid choice: '10.10' (choose from '10.6', '10.7', '10.8', '10.9')

Obviously the install package isn't configured for 10.10 because it isn't released to the public yet.

Is there a way to manually bypass this during the build process?

joshferrara
  • 759
  • 2
  • 7
  • 13

4 Answers4

88

This will probably be fixed in newer versions of MongoDB (https://jira.mongodb.org/browse/SERVER-14204), for now simply patch the formula.

brew edit mongodb

Find the block that looks like this:

args = %W[
  --prefix=#{prefix}
  -j#{ENV.make_jobs}
  --cc=#{ENV.cc}
  --cxx=#{ENV.cxx}
  --osx-version-min=#{MacOS.version}
]

And change the OS X version min to 10.9, like so:

args = %W[
  --prefix=#{prefix}
  -j#{ENV.make_jobs}
  --cc=#{ENV.cc}
  --cxx=#{ENV.cxx}
  --osx-version-min=10.9
]

EDIT: Extra step for DP3, DP4, PB1

Still in the file, add the following 3 lines just above def install.

  def patches
    { :p1 => 'https://gist.githubusercontent.com/LinusU/a1771562fec0201c54cd/raw/98825f9fbe93b8cc524e05a9c0e99864e8301731/mongodb.diff' }
  end

And then perform upgrade:

brew upgrade mongodb
uthark
  • 5,333
  • 2
  • 43
  • 59
Linus Unnebäck
  • 23,234
  • 15
  • 74
  • 89
  • This answer reflects a solution without breaking anything else – rememberlenny Jun 16 '14 at 01:47
  • Much better. Great suggestion! – joshferrara Jun 26 '14 at 15:29
  • The installation fails with this error: `Homebrew doesn't know what compiler versions ship with your version of Xcode (6.0).`. Any ideas on how to fix this? –  Jul 27 '14 at 00:30
  • 3
    This didn't help me. `2 errors generated. scons: *** [build/darwin/64/cc__usr_bin_clang/cxx__usr_bin_clang++/osx-version-min_10.9/third_party/s2/s2cellid.o] Error 1 scons: building terminated because of errors.` – Anton Danilchenko Jul 27 '14 at 15:34
  • 1
    @isal Are you on the latest version of homebrew? `brew update`. Also, this thread suggests that it's just a warning and can be ignored: https://github.com/Homebrew/homebrew/issues/29988 – Linus Unnebäck Jul 28 '14 at 09:45
  • @AntonDanilchenko See my edit, it should solve your problem :) – Linus Unnebäck Jul 28 '14 at 09:46
  • @LinusUnnebäck how to revert back to original files when mongodb team fixed this issue? – Anton Danilchenko Aug 01 '14 at 07:23
  • `cd \`brew --prefix\`` and `git stash` should work. This will remove the changes made to the file. Also, `brew update` might complain that it will overwrite your changes and refuse to continue. That means that the formula has been updated in Homebrew. In that case, just run the commands to revert the changes and then `brew update` should work. – Linus Unnebäck Aug 01 '14 at 09:17
  • getting an error `scons: *** Do not know how to make File target 10.10' (/private/tmp/mongodb-NF9O/mongodb-src-r2.6.3/10.10). Stop.` `scons: building terminated because of errors.` – YarGnawh Aug 08 '14 at 16:30
  • @IvanR If it's opening it with `vim`, `i` to enter insert mode. Type the text you want. `esc` to exit insert mode. `:wq` and `return` to **w**rite and **q**uit. – Linus Unnebäck Aug 11 '14 at 08:53
  • Tried this. Worked, though the upgrade took longer than usual. Also, when i tried to start mongodb via `launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist`, I got a messaged saying `Service is disabled`. I restarted via `brew services restart mongodb` and got the usual `brew services is unsupported` but it started and all is good. – Angel S. Moreno Aug 21 '14 at 07:03
  • after `brew upgrade mongodb` I get an error: `Error: MongoDB not installed` – user101289 Sep 05 '14 at 02:16
  • @user101289 which means you need to run `brew install mongodb` instead of `brew upgrade mongodb` – Lunf Sep 07 '14 at 19:20
4

Just to mention – this issue has been fixed.
Built and installed today (10/13/2014) via $ brew install mongodb

==> Summary
  /usr/local/Cellar/mongodb/2.6.5: 17 files, 331M, built in 21.6 minutes
ajndl
  • 395
  • 1
  • 7
3

If the steps described by Linus are not sufficient, perform the additional steps (10.10 beta 3 and beta 4):

  1. cd /Library/Caches/Homebrew/
  2. tar xvfz mongodb-2.6.3.tar.gz
  3. cd mongodb-src-r2.6.3
  4. vi src/third_party/s2/util/endian/endian.h
  5. Uncomment lines 181-189

    // This one is safe to take as it's an extension
    //#define htonll(x) ghtonll(x)
    //
    // ntoh* and hton* are the same thing for any size and bytesex,
    // since the function is an involution, i.e., its own inverse.
    //#define gntohl(x) ghtonl(x)
    //#define gntohs(x) ghtons(x)
    //#define gntohll(x) ghtonll(x)
    //#define ntohll(x) htonll(x)
    
  6. cd ..
  7. rm mongodb-2.6.3.tar.gz
  8. tar cvfz mongodb-2.6.3.tar.gz mongodb-src-r2.6.3
  9. brew install mongodb

    ==> Downloading http://downloads.mongodb.org/src/mongodb-src-r2.6.3.tar.gz
    Already downloaded: /Library/Caches/Homebrew/mongodb-2.6.3.tar.gz
    Error: SHA1 mismatch
    Expected: 226ab45e3a2e4d4a749271f1bce393ea8358d3dd
    Actual: 593bbe9cb7e0b1d2368b3b6487893e8ba459acfb
    Archive: /Library/Caches/Homebrew/mongodb-2.6.3.tar.gz
    
  10. Copy the actual SHA1
  11. brew edit mongodb
  12. Replace the expected SHA1 value with the actual one.
  13. brew install mongodb
  14. rm -rf mongodb-src-r2.6.3
hirro
  • 671
  • 10
  • 17
  • 1
    I've updated my answer to incorporate your patch, thanks! To avoid modifying the source I added it to the formula so that brew itself can download and do the actual patching. – Linus Unnebäck Jul 28 '14 at 09:48
1

Looks like a patch has been suggested. But I don't really have any info - https://groups.google.com/forum/#!topic/mongodb-user/KToczUct6BE

I would like to see it working as well.

tspore
  • 1,349
  • 2
  • 11
  • 14
  • Worked for me. The present GIT repo is compatible with Yosemite. But I needed **pymongo** before installing the mongodb. It's easy `sudo pip install pymongo` – iraycd Oct 07 '14 at 10:35