Install moon
The following guide can be used to install moon and integrate it into an existing repository (with or without incremental adoption), or to a fresh repository.
Installing
The entirety of moon is packaged and shipped as a single binary. It works on all major operating systems, and does not require any external dependencies. For convenience, we provide the following scripts to download and install moon.
Linux, macOS, WSL
In a terminal that supports Bash, run:
curl -fsSL https://moonrepo.dev/install/moon.sh | bash
This will install moon to ~/.moon/bin
and create a symlink in /usr/local/bin
. If the symlink
fails, you'll need to set the PATH
manually in your shell.
export PATH="$HOME/.moon/bin:$PATH"
Windows
In Powershell or Windows Terminal, run:
irm https://moonrepo.dev/install/moon.ps1 | iex
This will install moon to ~\.moon\bin
and prepend to the PATH
environment variable for the
current session. To persist across sessions, update PATH
manually.
proto
moon can be installed and managed in proto's toolchain using a TOML plugin. This will
install moon to ~/.proto/tools/moon
and make the binary available at ~/.proto/bin
.
[plugins]
moon = "source:https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml"
proto install moon
Furthermore, the version of moon can be pinned on a per-project basis using the .prototools
file.
moon = "1.3.0"
Node.js
moon is also packaged and shipped as a single binary through the
@moonrepo/cli
npm package. Begin by installing this
package at the root of the repository. This is also useful in pinning the exact version the
repository should be using.
- Yarn
- Yarn (classic)
- npm
- pnpm
yarn add --dev @moonrepo/cli
yarn add --dev @moonrepo/cli
# If using workspaces
yarn add --dev -W @moonrepo/cli
npm install --save-dev @moonrepo/cli
pnpm add --save-dev @moonrepo/cli
# If using workspaces
pnpm add --save-dev -w @moonrepo/cli
Other
moon can also be downloaded and installed manually, by downloading an asset from
https://github.com/moonrepo/moon/releases. Be sure to
rename the file after downloading, and apply the executable bit (chmod +x
) on macOS and Linux.
Upgrading
moon can be upgraded with the moon upgrade
command. However, this will only
upgrade moon if it was installed in ~/.moon/bin
.
moon upgrade
Otherwise, you can re-run the installers above and it will download, install, and overwrite with the latest version.