Skip to content
Latchkey

bunx: Run Package Binaries Without Installing

bunx runs a package binary, fetching it on the fly if it is not already installed, the way npx does but faster.

bunx is the throwaway-tool runner: scaffolders, one-off codegen, formatters you do not want as a dependency. In CI it avoids adding tools to package.json just to run them once.

What it does

bunx (an alias for bun x) resolves a package binary, using a local install if present or downloading into the cache otherwise, then runs it. You can pin a version with @ and force the Bun runtime with --bun.

Common usage

Terminal
bunx cowsay "hello"
bunx prettier@3 --check .           # pin a major, do not install it
bunx --bun vite build              # run vite under Bun
bunx create-next-app my-app        # scaffolder, fetched on demand

Options

FlagWhat it does
<package>[@version]Binary to run, optionally version-pinned
--bunRun the binary under the Bun runtime, not Node
--no-installOnly run if already installed; do not fetch
--silentSuppress Bun output

In CI

Pin a version (bunx tool@1.2.3) in pipelines so a new release of the tool cannot change behavior mid-stream. The download lands in ~/.bun/install/cache, so caching that path speeds up repeated bunx calls. If a tool spawns Node internally and breaks, add --bun to keep it on Bun, or fall back to installing it as a dependency.

Common errors in CI

"error: <package> not found" means the binary name does not match the package or it is not published; many packages expose a bin name different from the package name. Network failures fetching a tool show as resolution errors; pin the version and cache the store. If --bun causes a crash, the tool is not Bun-compatible; drop --bun.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →