# How to Manage MongoDB Database Tools Separately from the Server Using m

> Learn how to manage MongoDB Database Tools independently from the server using the m version manager. Install, activate, and remove tools easily with dedicated subcommands.

- Repository: [Aaron Heckmann/m](https://github.com/aheckmann/m)
- Tags: how-to-guide
- Published: 2026-02-23

---

**The `m` version manager treats MongoDB Database Tools as first-class artifacts that can be installed, activated, and removed independently of the MongoDB server binaries through dedicated `tools` subcommands.**

The `m` CLI is a Bash-based version manager for MongoDB that provides granular control over Database Tools like `mongodump`, `mongorestore`, and `mongoexport`. Unlike traditional installations that bundle utilities with the server package, `m` enables you to manage Tools versions in isolation, allowing you to upgrade utilities without risking production server stability. This guide explains how to leverage the source code implementation in `bin/m` to isolate and control MongoDB Database Tools separately from the server.

## Architecture of Tools Management in m

The separation of concerns is enforced through dedicated directory structures and install logic defined in `bin/m`.

The system uses **`TOOLS_DIR`** (default: `$M_PREFIX/m/tools/versions`) to store each Tools version in its own subdirectory, distinct from the server versions directory. According to lines 20‑22 of `bin/m`, this variable establishes the root path for all Database Tools installations.

Key functions governing this architecture include:

- **`get_all_tools_versions()`** (lines 00555‑00584): Builds the complete catalog of available releases, merging legacy server-bundled versions (≤ 4.3.1) with modern standalone releases from the MongoDB Tools GitHub repository.
- **`install_tools()`** (lines 01212‑01234): The core orchestrator that resolves version requests, delegates downloads for standalone versions (> 4.3.2), and creates symlinks in `$M_BIN_DIR`.
- **`install_tools_bin()`** (lines 00807‑00836): Handles platform-specific tarball extraction from `fastdl.mongodb.org/tools/db/` for versions newer than 4.3.2.
- **`check_current_tools_version()`** (lines 00442‑00448): Detects which Tools version is currently linked into the global bin directory.

When installing versions ≤ 4.3.1, `m` simply references the existing server binaries. For newer versions, it performs a dedicated download and symlinks the binaries (`mongodump`, `mongorestore`, etc.) into `$M_BIN_DIR`, making them available on your `$PATH`.

## Listing Available and Installed Tools Versions

Before installing, inspect the catalog of releases and your local inventory using the `tools` subcommand.

To view all available remote versions:

```bash

# Stable releases only

m tools ls

# Include release candidates

m tools ls --rc

```

The `list_tools_versions()` function (lines 00490‑00510) generates this output by querying the merged list from `get_all_tools_versions()`.

To see locally installed versions:

```bash

# Human-readable format

m tools installed

# Machine-readable JSON

m tools installed --json

```

The `display_tools_versions()` function (lines 00411‑00445) walks both `$TOOLS_DIR` and `$VERSIONS_DIR` to construct this inventory, distinguishing between standalone Tools installations and server-bundled versions.

## Installing and Activating Tools Versions

Install specific versions or the latest stable release using the install workflow.

To install the latest stable Tools version:

```bash
m tools stable

```

This triggers the following process in `install_tools()`:

1. Resolves the `stable` keyword to the newest version via `get_all_tools_versions()`.
2. For versions > 4.3.2, invokes `install_tools_bin()` to download and extract the tarball into `$TOOLS_DIR/<version>/`.
3. Symlinks all binaries into `$M_BIN_DIR` (line 01270).

To install a specific version (e.g., 100.9.4):

```bash
m tools 100.9.4

```

This follows the same code path but uses the explicit version string instead of resolving the stable tag.

## Switching Between and Using Specific Tools Versions

Activate or temporarily use specific Tools versions without disrupting your server installation.

To verify the currently active Tools version:

```bash
m tools

```

This invokes `check_current_tools_version()` to identify which version is currently symlinked in `$M_BIN_DIR`, displaying the active state alongside the installed list.

To use a specific version temporarily without changing the global symlink, invoke the binary directly from its versioned directory:

```bash
$HOME/.local/m/tools/versions/100.9.4/bin/mongodump --uri "mongodb://localhost" --out ./backup

```

Because each version resides under `$TOOLS_DIR/<version>/bin`, you can target specific binaries by path when testing or scripting without altering the system-wide active version.

## Removing Standalone Tools Versions

Clean up standalone installations while protecting server-bundled binaries.

To remove a previously installed Tools version:

```bash
m tools rm 100.9.4

```

The `remove_tools_versions()` function (lines 00595‑00633) performs safety checks to ensure the version is not a server-bundled release (≤ 4.3.2) before deleting the directory from `$TOOLS_DIR`. This prevents accidental removal of Tools that are integral to an existing server installation.

## Summary

- **`m` isolates Database Tools** using `TOOLS_DIR` (`$M_PREFIX/m/tools/versions`) separate from server binaries.
- **Versions ≤ 4.3.1** are server-bundled and referenced rather than downloaded; **versions > 4.3.2** are fetched separately from `fastdl.mongodb.org/tools/db/`.
- **Installation** is handled by `install_tools()` and `install_tools_bin()`, which extract archives and symlink binaries into `$M_BIN_DIR`.
- **Listing** commands (`m tools ls`, `m tools installed`) rely on `get_all_tools_versions()` and `display_tools_versions()` to merge remote catalogs with local inventories.
- **Removal** via `m tools rm` is guarded by `remove_tools_versions()` to prevent deletion of server-bundled Tools.

## Frequently Asked Questions

### What is the difference between server-bundled and separate Tools versions in m?

Versions 4.3.1 and earlier were distributed inside the MongoDB server package, so `m` simply references those existing binaries. Versions 4.3.2 and later are released independently; `m` downloads these from the dedicated Tools repository and stores them in `$TOOLS_DIR`, completely separate from server installations.

### How do I check which MongoDB Database Tools version is currently active?

Run `m tools` without arguments. This executes `check_current_tools_version()` (lines 00442‑00448) to inspect the symlinks in `$M_BIN_DIR` and highlight the active version among your installed list.

### Can I use a specific Tools version without making it the global default?

Yes. Because `m` stores each version in `$TOOLS_DIR/<version>/bin`, you can call the binary directly by path (e.g., `$TOOLS_DIR/100.9.4/bin/mongodump`) or temporarily override `M_BIN_DIR` for that session. This avoids changing the global symlinks managed by `m tools <version>`.

### What happens if I try to remove a server-bundled Tools version?

The `remove_tools_versions()` function (lines 00595‑00633) explicitly checks if the requested version is ≤ 4.3.2. If it detects a server-bundled version, it aborts the removal to prevent breaking the associated MongoDB server installation. Only standalone Tools versions downloaded separately can be removed.