Skip to Content
ScriptingScript Execution

Script Execution

Miso picks an interpreter per script — by file extension or shebang, falling back to sh.

Changing the Interpreter

You can run scripts with a different interpreter in three ways:

1. Use a Different File Extension

Miso selects the interpreter based on the file extension:

ExtensionInterpreterNotes
.shshPOSIX shell (default)
.bashbashBash
.zshzshZ shell
.js, .mjsnodeNode.js
.tsbun or nodebun when the project uses bun, otherwise node
.pypython3Python 3
.rbrubyRuby
.plperlPerl
.lualuaLua
.phpphpPHP

.ts runs on bun when your project uses bun — detected from the packageManager field in package.json, then from a bun lockfile — and otherwise on node. Bare node script.ts needs Node 23.6+ (or 22.6+ with --experimental-strip-types); bun runs TypeScript with no extra setup.

2. Configure the Default Shell in miso.json

For scripts with no recognized extension, you can override the default sh in miso.json:

>miso.json
{ "shell": "bash" }

3. Use a Shebang

While you don’t need one, if the first line starts with #!, Miso uses the specified interpreter:

#!/usr/bin/env node console.log("Running with Node.js");

Interpreter Requirements

Make sure the required interpreter is installed and available in your PATH:

which node which python3 which ruby

Working Directory

Scripts run from the project root, no matter where they sit in the scripts folder. Write paths relative to the root:

# scripts/build/miso.sh cd apps/miso && go build ./cmd

So you can reference project files consistently without caring where the script lives.

Local Binaries on PATH

Miso prepends node_modules/.bin to each script’s PATH, walking from the target directory up to the project root (nearest first). Locally-installed CLIs run bare — no npx or package-manager prefix:

drizzle-kit push # resolves node_modules/.bin/drizzle-kit wrangler deploy # resolves node_modules/.bin/wrangler

Error Handling

If a script exits with a non-zero status code, Miso will display the error and exit with the same code:

if [ -z "$1" ]; then echo "Error: Environment required" exit 1 fi

Logging from scripts

To print a styled message from a script, call miso log with a level, the text, and any key=value fields:

# scripts/dev.sh if ! command -v limactl >/dev/null; then miso log error "Building the Debian VM image requires Lima 2.x, but limactl was not found." \ install="brew install lima" then="miso dev" exit 2 fi miso log info "Booting VM"

Under miso dev, the line shows up with the script’s label:

[dev] ERROR Building the Debian VM image requires Lima 2.x, but limactl was not found. install="brew install lima" then="miso dev"

The levels are debug, info, warn, and error, and fields are written as key=value. If you run the script directly, outside miso, the same styled line prints without the label.

A valid miso log call always exits 0, so the script’s own exit decides whether it fails. A call with bad arguments exits 1, which ends the script when miso runs it.

Last updated on