docs/building.md
Please note that prebuilt binaries are available on mongodb.org and may be the easiest way to get started, rather than building from source.
To build MongoDB, you will need:
dnf install libcurl-devellibcurl-dev is provided by three packages. Install one of them:
libcurl4-openssl-devlibcurl4-nss-devlibcurl4-gnutls-devliblzma-devyum install xz-develmongod,
mongos, and mongo).If using a newer version of a C++ compiler than listed above, it may work. However the versions listed above have been verified to work.
MongoDB supports the following architectures: arm64, ppc64le, s390x, and x86-64. More detailed platform instructions can be found below.
python buildscripts/install_bazel.py
export PATH=~/.local/bin:$PATH
bazel build install-dist-test
bazel-bin/install/bin/mongod --version
If you only want to build the database server mongod:
$ bazel build install-mongod
Note: For C++ compilers that are newer than the supported
version, the compiler may issue new warnings that cause MongoDB to
fail to build since the build system treats compiler warnings as
errors. To ignore the warnings, pass the switch
--disable_warnings_as_errors=True to the bazel command.
$ bazel build install-mongod --disable_warnings_as_errors=True
If you want to build absolutely everything (mongod, mongo, unit
tests, etc):
$ bazel build --build_tag_filters=mongo_binary //src/mongo/...
The following targets can be named on the bazel command line to build and install a subset of components:
install-mongodinstall-mongosinstall-core (includes only mongod and mongos)install-dist (includes all server components)install-devcore (includes mongod, mongos, and jstestshell (formerly mongo shell))NOTE: The install-core and install-dist targets are not
guaranteed to be identical. The install-core target will only ever include a
minimal set of "core" server components, while install-dist is intended
for a functional end-user installation. If you are testing, you should use the
install-devcore or install-dist targets instead.
The build system will produce an installation tree into bazel-bin/install, as well
individual install target trees like bazel-bin/<install-target>.
Build requirements:
Or download a prebuilt binary for Windows at www.mongodb.org.
To install dependencies on Debian or Ubuntu systems:
# apt-get install build-essential
Install Xcode 16.4 or newer. Make sure macOS 15.5 platform is installed.
Install llvm and lld, version 19 from brew: brew install llvm@19 lld@19