moodle-cli ships three ways: a standalone binary with its runtime bundled in, an npm package, or a Bun package. Pick whichever fits how you already manage tools.

Standalone binary

The install script downloads a prebuilt binary and puts it on your PATH. It supports macOS on Apple Silicon (arm64) and Linux on x86_64 — on any other platform it prints a message telling you to use npm instead and exits.
The script:
  1. Detects your OS and architecture and picks the matching release asset (moodle-darwin-arm64 or moodle-linux-x64).
  2. Downloads it from the latest GitHub release into a temporary directory.
  3. Makes it executable and runs --version as a sanity check.
  4. Installs it to ~/.local/bin/moodle, creating the directory if needed.
Two environment variables change where it installs from and to: Add the install directory to your PATH if it isn’t already:
GitHub Releases may include other platform binaries. The install script itself only picks a binary for macOS arm64 and Linux x64; on any other OS or architecture it steps aside for npm.

npm

Run it without a global install:

Bun

Run it without a global install:

Node.js version

moodle-cli requires Node.js 22.13 or newer, because reading cookies out of a Chromium-based browser needs a feature Node only ships from that version on. On an older Node, moodle auth login fails with a message to upgrade Node or switch to Bun, which works on any version. Reading Safari’s cookie store doesn’t have this requirement. If you’re on an older Node and can’t upgrade it, use Bun instead:

Update

moodle update upgrades through whichever installer put moodle-cli there: npm, Bun, or the standalone binary replacing itself. When you have a deployed MCP server that is behind the new release, it redeploys that too. --check only reports the installed and latest versions.
  • It installs the exact release it just checked, so a registry mirror that lags behind fails loudly instead of installing an older build.
  • An npm update goes into the same location as the copy you are running.
  • A new standalone binary has to start and report its version before it replaces the current one; otherwise the old one stays.
moodle-cli checks for a newer release once a day in the background and prints a one-line notice on stderr when there is one. A deployed server makes the same daily check and tells connected AI clients, because it only redeploys from your computer. Set MOODLE_NO_UPDATE_CHECK=1 to turn the check off; it is already off when CI is set.

Shell completion

moodle completion <shell> prints a completion script for zsh, bash or fish. It completes top-level command names only.
Save the script somewhere on your fpath and let compinit pick it up:
Then add this to ~/.zshrc, before compinit runs:
Open a new shell to pick up the change.