Installation

mongrun is written in Python and it is currently tested with Python 3.8, 3.9, 3.10, and 3.11.

mongorun is only tested with actively supported (non End-of-Life) versions of the MongoDB server. As of November 2025, that includes MongoDB 7.0 or newer.

Prerequisites

Python

You need to have Python 3.8, 3.9, 3.10, or 3.11 installed in order to use mtools. Other versions of Python are not currently supported or tested.

To check your Python version, run python --version on the command line.

Installation with pip3

The easiest way to install mongorun is via pip3. From the command line, run:

pip3 install mongorun

You need to have Python 3.7 or newer installed. pip3 should be included as part of the default install for supported versions of Python 3.

Depending on your user rights, pip3 may complain about not having permissions to install into the system directory.

In that case, you either need to add sudo in front of the pip3 command to install into a system directory, or append --user to install into your home directory.

Installation from source

If pip3 is not available and you want to install mongorun from source, you can get the source code by cloning the mongorun github repository:

git clone git://github.com/mongodb/mongorun.git

Or download the tarball from PyPI and extract it with:

tar xzvf mongorun-<version>.tar.gz

Then cd into the mongorun directory and run:

sudo python setup.py install

This will install mongorun into your Python’s site-packages folder, create links to the scripts and set everything up. You should now be able to use all the scripts directly from the command line.

Dependencies

The full list of requirements (some of which are already included in the Python standard library) can be found in the requirements.txt file.

psutil

mongorun uses psutil to manage starting, stopping, and finding MongoDB processes.

pymongo

pymongo is MongoDB’s official Python driver. mrun uses this to configure and query local MongoDB deployments.