bun run & bunx in Bun

From the Bun cheat sheet ยท Running Scripts & Files ยท verified Jul 2026

bun run & bunx

Run files, package.json scripts, and remote packages

bash
# Run a TypeScript/JavaScript file
bun run index.ts
bun index.ts          # "run" is optional

# Run package.json scripts
bun run dev
bun run build

# Execute a package (like npx)
bunx cowsay "Hello!"
bunx --bun vite       # Force Bun runtime
๐Ÿ’ก bun --watch restarts the whole process on changes; --hot reloads modules in-place
โšก bun run is 30x faster than npm run โ€” it skips shell interpretation overhead
๐Ÿ“Œ bunx --bun forces packages like Vite or Prisma to run on Bun instead of Node
๐ŸŸข Bun auto-loads .env files โ€” no dotenv package needed
runbunxscriptswatch
Back to the full Bun cheat sheet