CLI Reference

Every magiclock subcommand and flag in one place.

Everything is one command: magiclock <subcommand> [options]. magiclock --version prints the installed version; bare magiclock prints help.

activate

Authenticate and provision this machine. Idempotent — safe to run again.

FlagMeaning
--server URLLicense server URL (falls back to a saved session, then $MAGICLOCK_SERVER).
--token TOKENBearer token (falls back to a saved session, then $MAGICLOCK_TOKEN).
--with-tokenHeadless mode: read a portal-minted token from $MAGICLOCK_TOKEN or stdin.
--no-browserIf sign-in is needed, print a link + code instead of opening a browser.

status

Show this machine's account and activation state.

FlagMeaning
--offlineSkip the live server round-trip; report from local state only.

protect

Encrypt a .py file (or a directory, recursively) into a gated .pya.

shell
magiclock protect PATH [-o OUT] [--remove]
                  [--trial | --expires-in DURATION | --expires-at DATE]
                  [--lock-passphrase | --no-bind-machine [--passphrase | --emit-key]]
FlagMeaning
PATHA .py file or a directory to protect recursively (.venv, venv, __pycache__, .git, dist, build are skipped automatically).
-o, --outOutput path (or output root, for directories).
--removeDelete the plaintext .py file(s) after encrypting.
--trialFixed 48-hour self-destruct — for demos.
--expires-in DURATIONStops decrypting after a duration (e.g. 30d).
--expires-at DATEStops decrypting on a date (e.g. 2026-12-31).
--lock-passphraseTwo-factor lock: this machine and a passphrase.
--no-bind-machinePortable artifact — no machine lock.
--passphraseWith --no-bind-machine: unlock with a passphrase ($MAGICLOCK_PASSPHRASE or a prompt).
--emit-keyWith --no-bind-machine: print a generated key for out-of-band distribution instead of a passphrase.

--trial/--expires-in/--expires-at are mutually exclusive with each other; --lock-passphrase is mutually exclusive with the --no-bind-machine group.

protect-model

Encrypt a model or any other resource into a .enc envelope. Takes the same expiry, --lock-passphrase, and portable flags as protect, plus:

FlagDefaultMeaning
PATHThe file to encrypt.
-o, --out<path>.encOutput path.
--feature NAMEai_modelThe license capability required to unlock this artifact.
--removeoffDelete the plaintext file after encrypting.

build

Compile an app to a native binary, inserting the license gate into every module automatically. See Compiled Build for the full walkthrough.

FlagDefaultMeaning
entryEntry-point .py file.
-o, --output-dirdistBuild output directory.
--source-rootthe entry fileProject root to scan/transform.
--moduleonCompile to a single-file native extension.
--standaloneCompile to a self-contained app directory instead. Mutually exclusive with --module.
--no-compileoffScan + inject + embed only, skip the native compile.
--keep-tmpoffKeep the intermediate transform directory.
--model PATHnoneEncrypt and bundle a model (repeatable).
--model-lock-passphraseoffTwo-factor lock for bundled models (needs ≥1 --model).
--model-trial / --model-expires-in / --model-expires-atnoneExpiry for bundled models — mutually exclusive with each other.

run

Run a .py or .pya, gate included.

FlagDefaultMeaning
entryThe file to run.
--app-version1.0.0App version, checked against any max_app_version your license sets.
--passphraseoffPrompt for a decryption passphrase (or read $MAGICLOCK_PASSPHRASE) — for portable or two-factor artifacts.
--key KEYPortable artifact decryption key (base64), or read $MAGICLOCK_DECRYPT_KEY.

deactivate

Remove this machine from your account.

FlagMeaning
--local-onlyClear the local vault without releasing the seat or revoking on the server.
--server URLServer URL for the release call.
--token TOKENBearer token for the release call.

completion

Print a shell tab-completion script.

shell
magiclock completion bash > /etc/bash_completion.d/magiclock
magiclock completion zsh  > "${fpath[1]}/_magiclock"