Version: 1.1.0

mojo build

Compile a Mojo file into an executable.

Essentials

  • -o sets the output path.
  • The result does not require the Mojo compiler on the target machine.
  • Dynamic libraries you called through FFI still need to be present.
  • Build flags can select optimization and target features.

Example

$ mojo build hello.mojo -o hello

Keep in mind

Put build outputs in a directory you ignore, not next to source, once a project has more than one file.