This lesson uses a POSIX shell in an existing jonnify checkout. You need Go 1.26.0 or later on PATH; the launcher uses that Go installation and never downloads a newer toolchain for you. A native Windows installation is not established by these shell instructions.
Run the right mg
From the repository root:
go version
scripts/mg help
alias mg="$PWD/scripts/mg"
mg version
The first invocation builds bin/mg. Later invocations still build, with Go’s cache reducing the work. The alias records this checkout’s absolute launcher path for the current shell, so you can change directory and continue to use the same source build.
Expect grouped command help, then a version report identifying mg and its build. Development builds can say devel+…, optionally with -dirty, or (devel) when revision metadata is absent. You do not need a release version to complete this lesson.
On macOS, /usr/bin/mg is an editor. If mg opens an editor, exit it and run scripts/mg help from the checkout root again; establish the alias before continuing. A bare command name alone does not identify the tool.
Let help guide you
mg help
mg help version
mg version --help
The last two commands show the same command help. Root help groups the available commands and identifies the kind of directory you are in. Running bare mg prints usage on stderr and exits 2; use mg help when you want a successful help request.
Try one deliberate typo:
mg hlep
The diagnostic begins:
Error: unknown command "hlep" for "mg"
Did you mean "mg help"? It would show mg's commands, or one command's usage, examples and docs.
Expect exit 2 and a suggestion for mg help; mg does not run the suggested command automatically. Run the corrected command yourself.
Complete commands in your shell
For zsh, initialize completion if your shell has not already done so, then load mg’s script:
autoload -Uz compinit
compinit
source <(mg completion zsh)
For bash, load the script into the current shell:
source <(mg completion bash)
mg completion also emits fish and PowerShell scripts. Follow the loading rules of the selected shell. Completion output is shell code: omit --json when sourcing it.
Recover from setup problems
MG-GO-MISSING or MG-GO-OLD means the launcher could not build with the Go on PATH; install or select a sufficient local Go and retry. MG-BUILD-FAILED means compilation failed: read the compiler diagnostics above it, including any dependency-download failure. These cases exit 3 and do not establish a working mg.
You are ready when help and version succeed, and the deliberate typo fails with guidance. Continue with Generate examples, or learn JSON and recovery.