Status: earlyRead the docs →

Cargo for Mojo.

mopm is "cargo for Mojo": a package manager plus build, test and coverage tooling for Mojo projects, with a package registry at mopm.dev.

Install the mopm CLI with one command

curl -fsSL https://mopm.dev/install.sh | sh

Release binaries for Linux (x86_64, arm64) and macOS (arm64). The script checks the download against the release’s SHA256SUMS, installs ~/.mopm/bin/mopm and needs no root. Read the script first, and see the release files and how to verify them.

Homebrew: planned · apt: planned

mopm new my_package --lib
cd my_package
mopm metadata
mopm test
mopm repl

Quickstart

Three steps to your first package

  1. Install mopm

    Run the install command above, then check it.

    mopm --version
  2. Start a package

    mopm init makes one in the current directory instead. mopm test runs its tests in a Mojo environment.

    mopm new my_package --lib
  3. Add a package

    In a mopm project, mopm add <namespace>/<name> adds it to mopm.toml and writes mopm.lock; mopm sync installs it.

    mopm add <namespace>/<name>

Recently updated

Fresh on the registry

Loading recently updated packages…

The list of recent packages needs JavaScript. Browse all packages instead.

Install from the registry

Add a package as cargo adds a crate

In a mopm project, mopm add <namespace>/<name> resolves it against the registry’s index and writes mopm.toml and mopm.lock.

Or write it under [dependencies] in mopm.toml yourself, then run mopm sync: it locks the project and installs every package it needs. Each package’s page shows its line.

Working today

What mopm does now

Status: early. mopm --version, mopm link-plan, mopm metadata, mopm new, mopm init, mopm build, mopm run, mopm repl, mopm test, mopm login, mopm logout, mopm whoami, mopm pack, mopm publish, mopm lock, mopm update, mopm tree, mopm sync, mopm add, mopm remove, mopm plan, mopm unit, mopm yank, mopm stage and mopm org work today. Everything else is a plan, and the design may change.

mopm runs the mojo of a Mojo environment: --prefix <dir>, else CONDA_PREFIX, else MODULAR_HOME without its /share/max. test, repl, build and run need one.

These commands work today, in a new package:

mopm new my_package --lib      # or --bin; `mopm init` makes one in the current directory
cd my_package
mopm metadata                  # check mopm.toml and print it as JSON
mopm test                      # tests/**/test_*.mojo, one process per test
mopm repl                      # mojo repl with the native libraries preloaded

Build and run take a Mojo file with a main (hello.mojo here is your own file):

mopm build hello.mojo -o hello # links the native libraries of the environment
mopm run hello.mojo

build, run and repl each run <env>/bin/mojo in place of mopm, so stdin, signals and the exit status are mojo’s; --print-cmd prints the command instead. test starts one mojo process per test. How mopm test works.

New here? Getting started walks through install, a first package, dependencies, tests and publishing; Why mopm, and how it is built is the design.

Releases

Release files and how to check them

Each GitHub release lists mopm-<version>-<target>.tar.gz for linux-x86_64, linux-aarch64 and macos-arm64, a SHA256SUMS file, and a .sigstore.json signature bundle for each of those files. Versions are 0.0.x and are released automatically on every merge; the installer takes the latest.

To check a download beyond its sha256, use the GitHub attestation or the cosign signature (F is a release file):

gh attestation verify F -R komira-ai/mopm --signer-workflow komira-ai/mopm/.github/workflows/release.yml
cosign verify-blob --bundle F.sigstore.json \
  --certificate-identity https://github.com/komira-ai/mopm/.github/workflows/release.yml@refs/heads/main \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com F

macOS binaries are not signed or notarized by Apple yet.

To build from source instead you need Zig 0.12.0 (tools/install_zig.sh <dir> installs it, checked against a pinned sha256). CI builds and tests it on Linux x86_64, Linux aarch64 and macOS arm64.

git clone https://github.com/komira-ai/mopm
cd mopm
zig build            # builds zig-out/bin/mopm

Being built

Planned

Not implemented yet: cov, check, export and launch. The design may change.

  • Coverage for any Mojo package

    mopm cov builds and tests a package and reports line coverage, without the package adopting a particular build system.

  • Automatic native linking for downstream consumers

    Build, run and REPL link the native libraries of an environment today, and lock and sync install locked packages into one. A coverage report and a larger catalogue are what is still to come.