A MoonBit-native, uv-style toolchain and package manager: manage MoonBit toolchains and install tools from mooncakes.io.
Dependencies
curl -LsSf https://raw.githubusercontent.com/tomasky/mb/main/install.sh | bashpnpm install -g @tomasko/mbmoon build --target native --release
# binary: _build/native/release/build/cmd/mb/mb.exemb run [--moon <version>] <command> [args...]
mb moon list | install [version] | uninstall <version> | default <version> | which [version] | latest
mb tool install <author>/<module>[@<version>] [--force] [--bin-dir <dir>] [--moon <version>]
mb tool list [--outdated] | upgrade [--all] <name>... | uninstall [--all] <name>...
mb help | versionmb moon install # install the latest release
mb moon install 0.10.14 # install the release with moonc 0.10.14
mb moon install nightly # install the nightly build
mb moon list # installed toolchains + the release channel
mb moon default 0.10.14 # select the version ~/.local/bin points at
mb moon which # print the active moon binary
mb moon uninstall 0.10.14 # remove a toolchain and its ~/.local/bin shimsmb run moon build # run with the default managed toolchain
mb run --moon 0.10.14 moon test
mb run --moon nightly node script.jsmb tool install bobzhang/zip # latest version
mb tool install bobzhang/zip@0.1.1 # pinned version
mb tool install author/tool --moon 0.10.14 --bin-dir ~/.local/bin
mb tool list # or: mb tool list --outdated
mb tool upgrade author/tool # one or more names, or --all
mb tool uninstall author/tool # one or more names, or --all| Variable | Meaning | Default |
|---|---|---|
| MB_HOME | Data directory for toolchains and tools | ~/.local/share/mb |
| MB_BIN_DIR | Where executables are installed | ~/.local/bin |
| XDG_DATA_HOME | Used when MB_HOME is unset | ~/.local/share |
$MB_HOME/
moon/<version>/ # a full MoonBit toolchain (bin, lib, lib/core)
moon/.default # the selected version
tool/<author>-<name>/<version>/
src/ # extracted mooncakes source
tool.json # { name, version, bins, bin }git tag v0.1.4 && git push origin v0.1.4cd npmjs && npm publish --access publiccurl -LsSf https://raw.githubusercontent.com/tomasky/mb/main/install.sh | bashIt detects the platform, downloads mb-<target> (plus its .sha256) from
the latest release and installs it into ~/.local/bin. Options: --version<v>, --install-dir <dir>, --no-verify; environment: MB_VERSION,
MB_INSTALL_DIR, MB_REPO, MB_DOWNLOAD_BASE.Publishing to mooncakes.io ignores npmjs/: .moonignore at the
repository root excludes it (and build/editor junk) from the package that
moon publish uploads.moon check # type-check
moon test # run the test suite
moon info && moon fmtpub(all) suberror MbError {
MbError(String)
}pub struct MoonSpec {
download_key : String
store_name : String
}pub struct ToolInstallOpts {
spec : String
force : Bool
bin : String
moon : String
}pub struct ToolchainEnv {
moon : String
home : String?
bin : String?
}fn env_or(name : String, default : String) -> Stringfn is_executable_file(path : String) -> Boolfn readlink(path : String) -> String?fn run_capture(cmd : String) -> Stringfn run_status(cmd : String) -> Intfn shell_quote(s : String) -> Stringfn shim_points_into(target : String, dir : String) -> Boolfn tool_install(spec : String, toolchain_override : String, bin_override : String, force : Bool) -> Unit raise MbErrorInstall
Download zipA MoonBit-native, uv-style toolchain and package manager: manage MoonBit toolchains and install tools from mooncakes.io.
Dependencies