Skip to main content
bunx auto-installs and runs packages from npm. It is Bun’s equivalent of npx or yarn dlx.
bunx is an alias for bun x. Both are installed automatically when you install Bun.
~100x faster than npx — For locally installed packages, bunx starts nearly 100x faster than npx because Bun’s startup time is dramatically lower and packages are served from a global cache.

How it works

Packages on npm can declare executables in the "bin" field of their package.json:
bunx looks for a locally installed version of the package first, then falls back to auto-installing it from npm. Installed packages are stored in Bun’s global cache for future use, so subsequent runs are near-instant.

Running specific versions

Passing arguments and flags

Place arguments and flags after the executable name:

Using bun as the runtime

By default, bunx respects shebangs. If an executable has #!/usr/bin/env node, Bun spawns a node process to run it. To force execution under Bun’s runtime instead, add --bun before the executable name:

Specifying the package separately

When the binary name differs from the package name, use --package (or -p) to specify the package explicitly:

Forcing Bun as the runtime in a script

To always run a script with Bun regardless of who invokes it, use a Bun shebang in the file: