Moon CLI keeps itself up to date. Every update is signed and verified before it is activated, and the previous version stays on your machine so you can go back.
Automatic updatesLink to the Automatic updates section
During an agent session, at most once a day, Moon CLI looks for a new version in the background and installs it. Your session keeps running on the current version. When the session ends, Moon CLI tells you which version was installed: it is used the next time you run moon.
- After an error (network, server), Moon CLI tries again an hour later.
- Automatic updates don’t run without an interactive terminal, in continuous integration (when the
CIvariable is set), with aMOON_API_KEYkey, or from a copy ofmoonplaced outside the installation (since 0.3.1;MOON_INSTALL_DIRlets you manage such a copy). Moon Desktop, which runs Moon CLI without a terminal, handles updates itself (see With Moon Desktop).
To turn them off:
export MOON_DISABLE_AUTOUPDATE=1{
"updates": { "auto": false }
}The moon.json file is in ~/ (Windows: %USERPROFILE%\.config\moon\).
With Moon DesktopLink to the With Moon Desktop section
Moon Desktop runs Moon CLI without a terminal, where Moon CLI’s own automatic updates don’t run. Since Moon Desktop 2.0.1, the app takes care of it, with the same rules:
- at startup, if the copy of Moon CLI bundled with the app (Windows, Linux) is newer than the one on the computer, it is installed, after the same signature and checksum checks;
- at most once a day, and the first time a new version of the app starts, Moon Desktop runs the signed Moon CLI update (
moon update). On a Mac, where the app doesn’t bundle Moon CLI, this is how Moon CLI stays current.
A Code session in progress keeps its version: the new one is used for the next session, and a line in the title bar says so for 30 seconds. The previous version remains available for moon . Nothing happens if automatic updates are turned off (above), and the Moon Desktop setting “Update Moon CLI automatically” (“Settings” › “Moon Desktop” › “Updates”, or the “Quick settings” submenu of the File menu) turns them off for the app only.
Update nowLink to the Update now section
moon update| Option | Effect |
|---|---|
| (none) | Installs the latest version of the channel if it is newer. |
--to | Installs that specific version, even an older one. |
--force | Reinstalls even if you are already up to date. |
--channel | Picks the update channel; latest by default. |
moon update --to 0.2.2moon upgrade does the same thing as moon update.
The terminal shows these messages in French:
| Message | Meaning |
|---|---|
| “Moon CLI 0.6.1 est à jour.” (Moon CLI is up to date) | Nothing to install. |
| “Moon CLI … est installé. Il sera utilisé au prochain lancement de « moon ».” (Moon CLI … is installed and will be used the next time you run moon) | The new version is ready. |
| “Une mise à jour est déjà en cours dans une autre session.” (an update is already running in another session) | Another moon session is already updating: nothing to do. |
| “La version … n’est pas encore publiée pour votre plateforme (…).” (version … is not published for your platform yet) | Your machine keeps its current version. |
What gets checkedLink to the What gets checked section
- Moon CLI downloads the version’s manifest and checks its signature against a public key built into the binary. An invalid signature stops everything.
- It checks the SHA-256 checksum of the archive, then that of the unpacked binary, both listed in the signed manifest.
- It runs the new binary to make sure it starts on your machine. If it doesn’t, the installation is canceled.
- It activates the new version in a single step, with no in-between state.
Nothing is run from the server. A channel never goes backward, and an update without --to never installs a version older than yours.
If the update is refused, moon update shows “Mise à jour impossible :” (update failed:) followed by the reason, then suggests trying again later or reinstalling.
Go back to the previous versionLink to the Go back to the previous version section
Moon CLI keeps the active version and the previous one.
moon rollbackMoon CLI asks “Revenir à la version précédente de Moon CLI ? [o/N]” (go back to the previous version of Moon CLI?): type o (oui, yes) to confirm. The previous version becomes active the next time you start Moon CLI. In a script, add --yes: moon . If there is no previous version on the machine, Moon CLI says so. To go further back, use moon .
UninstallLink to the Uninstall section
moon uninstall- Moon CLI asks you to confirm (“Désinstaller … ? [o/N]”, uninstall …?; type
ofor yes). - It revokes your session with Moon AI and deletes the token from your machine, like
moon logout. - It removes the binary, the installed versions and the
PATHentry (the#block in your shell files, fish’s>>> moon cli >>> moon.fishfile, or the userPATHon Windows).
Your settings and the agent’s session history are kept.
| Option | Effect |
|---|---|
--purge | Also deletes your settings, your personal agent configuration, the session history and the caches: the moon folders in ~/, ~/.config, ~/.cache and ~/. |
--yes (or -y) | No confirmation. Required without an interactive terminal. |
On Windows, open a new terminal afterward so the PATH is up to date. If you installed Moon CLI in another folder with MOON_INSTALL_DIR, delete that folder yourself unless it is named Moon.
Uninstall by handLink to the Uninstall by hand section
If the command no longer works, first revoke the session in “Settings” › “Account and security” › “Moon CLI sessions” (chat.realmoon.ai/settings/account#security), then delete:
| Item | Windows | macOS, Linux, WSL |
|---|---|---|
| Binary and versions | the %LOCALAPPDATA%\Moon folder | ~/ and ~/ |
PATH entry | the entry in the user PATH | the # block in .zshrc, .bashrc, .bash_profile or .profile, or the ~/ file |
| Session, state and history (optional) | %USERPROFILE%\.local\share\moon | ~/ |
| Settings (optional) | %USERPROFILE%\.config\moon | ~/ |
Without a system keychain, the token is in the state folder; with a keychain, the moon-cli entry stays in the keychain until moon logout has cleared the session.
Coming from a 0.1.x versionLink to the Coming from a 0.1.x version section
On a 0.1.x version, moon update runs the online installer again, which installs the current version. You can also run the installation command again directly: see Installation. The installer removes moon-agent, the second binary shipped with the 0.1.x versions.
Release notesLink to the Release notes section
moon shows the installed version. What changes in each version is in the release notes.
If it doesn’t workLink to the If it doesn’t work section
- “Mise à jour impossible :” (update failed:) followed by a checksum or signature: see The checksum or signature doesn’t match.
- Other messages from
moon updateandmoon: see Updates and versions.rollback - Reinstall or start from scratch: see Uninstall or reinstall cleanly.