bunx
Execute JavaScript package binaries
TLDR
Download and execute a package from the registry
Check the version of a locally installed package (if found)
Force an executable to run with the Bun runtime (instead of Node)
Execute a binary that has a different name than its package
Download and execute a specific version of a package
SYNOPSIS
bunx [<options>] <package>[<@version>] [<args>...]
PARAMETERS
-y, --yes
Skip confirmation prompts during install
--registry <url>
Use custom npm registry (default: registry.npmjs.org)
--cache-dir <dir>
Custom directory for package cache
-g, --global
Install and run from global scope (experimental)
-h, --help
Display help and exit
--version
Output bunx version
DESCRIPTION
bunx is a command-line tool from Bun, an extremely fast JavaScript runtime, bundler, and package manager designed as a drop-in replacement for Node.js, npm, Webpack, and more. It functions like npx, enabling execution of binaries from npm packages without global or local installation.
When invoked as bunx <package> [<args>...], bunx checks Bun's global cache (typically ~/.bun/install/cache/bunx). If the package is absent, it downloads and installs it blazingly fast—often 20x quicker than npx due to Bun's optimized installer. It then runs the binary specified in the package's package.json 'bin' field.
Supports version pinning (package@1.0.0), scoped packages (@scope/pkg), and common CLIs like TypeScript, ESLint, or cowsay. Ideal for scripts, CI/CD, or one-off tools, ensuring reproducible runs without node_modules bloat. Works on Linux, macOS, Windows.
CAVEATS
Requires Bun installed (>=0.5.0). Only runs packages with 'bin' in package.json. Cache can grow large; clear with bun pm cache rm bunx. Not for production servers—use installed deps.
EXAMPLES
bunx cowsay 'moo'
bunx tsc --version
bunx eslint --init
bunx typescript@latest --help
CACHE MANAGEMENT
View: bun pm cache ls bunx
Clear: bun pm cache rm bunx
Default path: ~/.bun/install/cache/bunx
HISTORY
Launched in September 2022 with Bun 0.1 by Jarred Sumner (ex-WebKit). Evolved rapidly; by Bun 1.0 (2023), became production-ready npx drop-in with 10-30x speed gains over npm.


