Error when trying to install mongodb-community@7.0 on macOS 11 via Homebrew

I am trying to install mongodb-community@7.0 on macOS 11 using Homebrew. I have verified I am meeting the prerequisites. I have xcode-select installed (version 2384) and I have run brew update, which tells me I am already up to date.

The brew tap mongodb/brew command completes without any errors. The brew update command completes without any errors and tells me it is already up to date.

When I run the brew install mongodb-community@7.0 command, it fails during the following step:

==> Installing mongodb/brew/mongodb-community@7.0 dependency: node
==> ./configure --without-npm --without-corepack --with-intl=system-icu --shared-libuv --shared-nghttp2 --shared-openssl --shared-zlib --shared-brotli --shared-cares --shared-libuv-includes=/usr/local/opt/libuv/include --shared-libuv-libpath=/usr/local/opt/libuv/lib --shar
==> make install

After those three lines, I get the following output:

Last 15 lines from /Users/mcmac/Library/Logs/Homebrew/node/02.make: ^ /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/c++/v1/string:791:40: note: explicit constructor is not a candidate _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/c++/v1/string:853:18: note: explicit constructor is not a candidate explicit basic_string(const _Tp& __t); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/c++/v1/string:875:5: note: candidate function operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } ^ 2 errors generated. make[1]: *** [/private/tmp/node-20241016-30678-xqscqv/node-v22.9.0/out/Release/obj.target/libnode/src/compile_cache.o] Error 1 make[1]: *** Waiting for unfinished jobs.... rm 0201fdcd5c02ef99803d0393bac31fd79f976eb0.intermediate 1ff803ef922475acb467591107c4c427b47b90f9.intermediate make: *** [node] Error 2

Can anyone tell me what I’m doing wrong? I’ve tried searching various strings from the error output of the terminal, without any luck. I’ve also tried following the suggested GitHub issue link provided by Homebrew in the error message, but it was not relevant to my issue.

I’ve only installed mongodb-community once before, a few years ago on an older version of macOS and everything worked that time. I’m not sure what else to try.