You can use the MongoDB Command Line Interface (mongocli) to deploy and manage MongoDB clusters in Atlas, Cloud Manager, and Ops Manager. For operating system and MongoDB service version requirements, see Compatibility.
To verify packages before installation, see Verify the Integrity of MongoDB CLI Packages.
Select an installation method:
Install the MongoDB CLI
Follow the steps for your selected installation method.
Prerequisites
To install the MongoDB CLI using Homebrew, you must:
Use a MacOS or Linux operating system.
Install Homebrew.
Procedure
Procedure
Install the MongoDB CLI.
Download and extract the correct binary for your operating system:
Operating SystemDownloadWindows
MacOS
Ubuntu/Debian
RHEL/CentOS/SLES/AMZ
Linux
Note
Replace or remove any existing MongoDB CLI binaries to prevent conflicts between versions.
Run the executable file.
Tip
You can run the binary from any directory. Because you don't need to install the MongoDB CLI into a global location, you can use it on shared hosts and other systems where you don't have a privileged account.
Add mongocli to your PATH.
To run mongocli commands from anywhere in your system, you must either:
Add the location of the executable to your
PATHorMove the executable to a directory in your
PATH.
You can accomplish this in several ways, depending on your personal settings and environment. Consult the documentation for your shell and operating system for more examples.
Example
In the following example, the user downloads and installs the MongoDB CLI by cloning the GitHub repository. The mongocli executable file saves to the location specified by your $GOPATH environment variable. The default location is $HOME/go on Unix systems and %USERPROFILE%\go on Windows.
The user then adds this directory to their PATH:
export PATH="$HOME/go:$PATH"
Example
In the following example, the user downloads and extracts a binary for the MongoDB CLI to the /mcli_2.0.9-macOS_x86_64 directory.
The user then moves the executable file to a directory already in their PATH:
cd mcli_2.0.9-macOS_x86_64 mv mongocli /usr/local/bin
Update the MongoDB CLI
Follow the steps below to update the MongoDB CLI:
Next Steps
Configure the MongoDB CLI for your environment.
Enable autocomplete to see available commands and their syntax directly in your shell.