Bun is a fast JavaScript runtime, package manager, bundler, and test runner. (1.4.4+38afee6c8)
Usage: bun <command> [...flags] [...args]
Commands:
run ./my-script.ts Execute a file with Bun
dev Run a package.json script
test Run unit tests with Bun
check Type check a TypeScript project
fmt Format JavaScript and TypeScript, like Prettier
x vite Execute a package binary (CLI), installing if needed (bunx)
repl Start a REPL session with Bun
exec Run a shell script directly with Bun
install Install dependencies for a package.json (bun i)
add @evan/duckdb Add a dependency to package.json (bun a)
remove browserify Remove a dependency from package.json (bun rm)
update @zarfjs/zarf Update outdated dependencies
audit Check installed packages for vulnerabilities
dedupe Remove duplicate versions from the lockfile
prune Remove packages that are not in the lockfile from node_modules
outdated Display latest versions of outdated dependencies
link [<package>] Register or link a local npm package
unlink Unregister a local npm package
publish Publish a package to the npm registry
patch <pkg> Prepare a package for patching
pm <subcommand> Additional package management utilities
info zod Display package metadata from the registry
why tailwindcss Explain why a package is installed
build ./a.ts ./b.jsx Bundle TypeScript & JavaScript into a single file
init Start an empty Bun project from a built-in template
create astro Create a new project from a template (bun c)
upgrade Upgrade to latest version of Bun.
<command> --help Print help text for command.
Flags:
--silent Don't print the script command
--elide-lines=<val> Number of lines of script output shown when using --filter (default: 0, show all lines)
-v, --version Print version and exit
--revision Print version with revision and exit
-F, --filter=<val> Run a script in all workspace packages matching the pattern
-b, --bun Force a script or package to use Bun's runtime instead of Node.js (via symlinking node)
--no-orphans Exit when the parent process dies, and on exit kill every descendant.
--shell=<val> Control the shell used for package.json scripts. Supports either 'bun' or 'system'
--workspaces Run a script in all workspace packages (from the "workspaces" field in package.json)
--parallel Run multiple scripts concurrently with Foreman-style output
--sequential Run multiple scripts sequentially with Foreman-style output
--no-exit-on-error Continue running other scripts when one fails (with --parallel/--sequential)
--watch Automatically restart the process on file change
--watch-kill-signal=<val> Signal whose handlers run when --watch restarts the process (default: "SIGTERM")
--hot Enable auto reload in the Bun runtime, test runner, or bundler
--no-clear-screen Disable clearing the terminal screen on reload when --hot or --watch is enabled
--check Type check before running. Nothing runs if there are type errors. Alone: bun check
--smol Use less memory, but run garbage collection more often
--interactive Start a Node.js-compatible REPL, like node --interactive
-r, --preload=<val> Import a module before other modules are loaded
--require=<val> Alias of --preload, for Node.js compatibility
--import=<val> Alias of --preload, for Node.js compatibility
--inspect=<val> Activate Bun's debugger
--inspect-wait=<val> Activate Bun's debugger, wait for a connection before executing
--inspect-brk=<val> Activate Bun's debugger, set breakpoint on first line of code and wait
--cpu-prof Start CPU profiler and write profile to disk on exit
--cpu-prof-name=<val> Specify the name of the CPU profile file
--cpu-prof-dir=<val> Specify the directory where the CPU profile will be saved
--cpu-prof-md Output CPU profile in markdown format (grep-friendly, designed for LLM analysis)
--cpu-prof-interval=<val> Specify the sampling interval in microseconds for CPU profiling (default: 1000)
--heap-prof Write a heap profile to disk on exit (.heapprofile)
--heap-prof-name=<val> Specify the name of the heap profile file
--heap-prof-dir=<val> Specify the directory where the heap profile will be saved
--heap-prof-md Generate markdown heap profile on exit (for CLI analysis)
--heap-prof-interval=<val> Specify the average sampling interval in bytes for heap profiling (default: 524288)
--if-present Exit without an error if the entrypoint does not exist
--no-install Disable auto install in the Bun runtime
--install=<val> Configure auto-install behavior. One of "auto" (default, auto-installs when no node_modules), "fallback" (missing packages only), "force" (always).
-i Auto-install dependencies during execution. Equivalent to --install=fallback.
-e, --eval=<val> Evaluate argument as a script
-p, --print=<val> Evaluate argument as a script and print the result
--prefer-offline Skip staleness checks for packages in the Bun runtime and resolve from disk
--prefer-latest Use the latest matching versions of packages in the Bun runtime, always checking npm
--port=<val> Set the default port for Bun.serve
--conditions=<val> Pass custom conditions to resolve
--fetch-preconnect=<val> Preconnect to a URL while code is loading
--experimental-http2-fetch Offer h2 in fetch() TLS ALPN. Same as BUN_FEATURE_FLAG_EXPERIMENTAL_HTTP2_CLIENT=1
--experimental-http3-fetch Honor Alt-Svc: h3 in fetch() and upgrade to HTTP/3. Same as BUN_FEATURE_FLAG_EXPERIMENTAL_HTTP3_CLIENT=1
--max-http-header-size=<val> Set the maximum size of HTTP headers in bytes. Default is 16KiB
--insecure-http-parser Use an insecure HTTP parser that accepts invalid HTTP headers
--dns-result-order=<val> Set the default order of DNS lookup results. Valid orders: verbatim (default), ipv4first, ipv6first
--experimental-stream-iter Enable the experimental stream/iter API (node:stream/iter, node:zlib/iter).
--expose-gc Expose gc() on the global object. Has no effect on Bun.gc().
--no-deprecation Suppress all reporting of the custom deprecation.
--throw-deprecation Determine whether or not deprecation warnings result in errors.
--no-warnings Silence all process warnings
--trace-warnings Show stack traces on process warnings
--trace-deprecation Show stack traces on deprecations
--pending-deprecation Emit pending deprecation warnings
--redirect-warnings=<val> Write process warnings to the given file instead of printing to stderr
--disable-warning=<val> Silence specific process warnings by code or type
--title=<val> Set the process title
--zero-fill-buffers Boolean to force Buffer.allocUnsafe(size) to be zero-filled.
--use-system-ca Use the system's trusted certificate authorities
--use-openssl-ca Use OpenSSL's default CA store
--use-bundled-ca Use bundled CA store
--tls-min-v1.0 Set the default TLS minimum to TLSv1.0
--tls-min-v1.1 Set the default TLS minimum to TLSv1.1
--tls-min-v1.2 Set the default TLS minimum to TLSv1.2
--tls-min-v1.3 Set the default TLS minimum to TLSv1.3
--tls-max-v1.2 Set the default TLS maximum to TLSv1.2
--tls-max-v1.3 Set the default TLS maximum to TLSv1.3
--redis-preconnect Preconnect to $REDIS_URL at startup
--sql-preconnect Preconnect to PostgreSQL at startup
--no-addons Throw an error if process.dlopen or bun:ffi cc() is called, and disable export condition "node-addons"
--no-ffi-cc Throw an error if bun:ffi cc() is called (disables the C compiler)
--unhandled-rejections=<val> One of "strict", "throw", "warn", "none", or "warn-with-error-code"
--console-depth=<val> Set the default depth for console.log object inspection (default: 2)
--user-agent=<val> Set the default User-Agent header for HTTP requests
--cron-title=<val> Title for cron execution mode
--cron-period=<val> Cron period for cron execution mode
--main-fields=<val> Main fields to lookup in package.json. Defaults to --target dependent
--preserve-symlinks Preserve symlinks when resolving files
--preserve-symlinks-main Preserve symlinks when resolving the main entry point
--extension-order=<val> Defaults to: .tsx,.ts,.jsx,.js,.json
--tsconfig-override=<val> Specify custom tsconfig.json. Default $cwd/tsconfig.json
-d, --define=<val> Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:"development". Values are parsed as JSON.
--drop=<val> Remove function calls, e.g. --drop=console removes all console.* calls.
--feature=<val> Enable a feature flag for dead-code elimination, e.g. --feature=SUPER_SECRET
-l, --loader=<val> Parse files with .ext:loader, e.g. --loader .js:jsx. Valid loaders: js, jsx, ts, tsx, json, toml, text, file, wasm, napi
--no-macros Disable macros from being executed in the bundler, transpiler and runtime
--jsx-factory=<val> Changes the function called when compiling JSX elements using the classic JSX runtime
--jsx-fragment=<val> Changes the function called when compiling JSX fragments
--jsx-import-source=<val> Declares the module specifier to be used for importing the jsx and jsxs factory functions. Default: "react"
--jsx-runtime=<val> "automatic" (default) or "classic"
--jsx-side-effects Treat JSX elements as having side effects (disable pure annotations)
--ignore-dce-annotations Ignore tree-shaking annotations such as @__PURE__
--env-file=<val> Load environment variables from the specified file(s)
--no-env-file Disable automatic loading of .env files
--cwd=<val> Absolute path to resolve files & entry points from. This just changes the process' cwd.
-c, --config=<val> Specify path to Bun config file. Default $cwd/bunfig.toml
-h, --help Display this menu and exit
(more flags in bun install --help, bun test --help, and bun build --help)
Learn more about Bun: https://bun.com/docs
Join our Discord community: https://bun.com/discord
Options (102)
| Option | Description | Source |
|---|---|---|
--silent | Don't print the script command | help |
--elide-lines val | Number of lines of script output shown when using --filter (default: 0, show all lines) | help |
-v, --version | Print version and exit | help |
--revision | Print version with revision and exit | help |
-F, --filter val | Run a script in all workspace packages matching the pattern | help |
-b, --bun | Force a script or package to use Bun's runtime instead of Node.js (via symlinking node) | help |
--no-orphans | Exit when the parent process dies, and on exit kill every descendant. | help |
--shell val | Control the shell used for package.json scripts. | help |
--workspaces | Run a script in all workspace packages (from the "workspaces" field in package.json) | help |
--parallel | Run multiple scripts concurrently with Foreman-style output | help |
--sequential | Run multiple scripts sequentially with Foreman-style output | help |
--no-exit-on-error | Continue running other scripts when one fails (with --parallel/--sequential) | help |
--watch | Automatically restart the process on file change | help |
--watch-kill-signal val | Signal whose handlers run when --watch restarts the process (default: "SIGTERM") | help |
--hot | Enable auto reload in the Bun runtime, test runner, or bundler | help |
--no-clear-screen | Disable clearing the terminal screen on reload when --hot or --watch is enabled | help |
--check | Type check before running. | help |
--smol | Use less memory, but run garbage collection more often | help |
--interactive | Start a Node.js-compatible REPL, like node --interactive | help |
-r, --preload val | Import a module before other modules are loaded | help |
--require val | Alias of --preload, for Node.js compatibility | help |
--import val | Alias of --preload, for Node.js compatibility | help |
--inspect val | Activate Bun's debugger | help |
--inspect-wait val | Activate Bun's debugger, wait for a connection before executing | help |
--inspect-brk val | Activate Bun's debugger, set breakpoint on first line of code and wait | help |
--cpu-prof | Start CPU profiler and write profile to disk on exit | help |
--cpu-prof-name val | Specify the name of the CPU profile file | help |
--cpu-prof-dir val | Specify the directory where the CPU profile will be saved | help |
--cpu-prof-md | Output CPU profile in markdown format (grep-friendly, designed for LLM analysis) | help |
--cpu-prof-interval val | Specify the sampling interval in microseconds for CPU profiling (default: 1000) | help |
--heap-prof | Write a heap profile to disk on exit (.heapprofile) | help |
--heap-prof-name val | Specify the name of the heap profile file | help |
--heap-prof-dir val | Specify the directory where the heap profile will be saved | help |
--heap-prof-md | Generate markdown heap profile on exit (for CLI analysis) | help |
--heap-prof-interval val | Specify the average sampling interval in bytes for heap profiling (default: 524288) | help |
--if-present | Exit without an error if the entrypoint does not exist | help |
--no-install | Disable auto install in the Bun runtime | help |
--install val | Configure auto-install behavior. | help |
-i | Auto-install dependencies during execution. | help |
-e, --eval val | Evaluate argument as a script | help |
-p, --print val | Evaluate argument as a script and print the result | help |
--prefer-offline | Skip staleness checks for packages in the Bun runtime and resolve from disk | help |
--prefer-latest | Use the latest matching versions of packages in the Bun runtime, always checking npm | help |
--port val | Set the default port for Bun.serve | help |
--conditions val | Pass custom conditions to resolve | help |
--fetch-preconnect val | Preconnect to a URL while code is loading | help |
--experimental-http2-fetch | Offer h2 in fetch() TLS ALPN. | help |
--experimental-http3-fetch | Honor Alt-Svc: h3 in fetch() and upgrade to HTTP/3. | help |
--max-http-header-size val | Set the maximum size of HTTP headers in bytes. | help |
--insecure-http-parser | Use an insecure HTTP parser that accepts invalid HTTP headers | help |
--dns-result-order val | Set the default order of DNS lookup results. | help |
--experimental-stream-iter | Enable the experimental stream/iter API (node:stream/iter, node:zlib/iter). | help |
--expose-gc | Expose gc() on the global object. | help |
--no-deprecation | Suppress all reporting of the custom deprecation. | help |
--throw-deprecation | Determine whether or not deprecation warnings result in errors. | help |
--no-warnings | Silence all process warnings | help |
--trace-warnings | Show stack traces on process warnings | help |
--trace-deprecation | Show stack traces on deprecations | help |
--pending-deprecation | Emit pending deprecation warnings | help |
--redirect-warnings val | Write process warnings to the given file instead of printing to stderr | help |
--disable-warning val | Silence specific process warnings by code or type | help |
--title val | Set the process title | help |
--zero-fill-buffers | Boolean to force Buffer.allocUnsafe(size) to be zero-filled. | help |
--use-system-ca | Use the system's trusted certificate authorities | help |
--use-openssl-ca | Use OpenSSL's default CA store | help |
--use-bundled-ca | Use bundled CA store | help |
--tls-min-v1.0 | Set the default TLS minimum to TLSv1.0 | help |
--tls-min-v1.1 | Set the default TLS minimum to TLSv1.1 | help |
--tls-min-v1.2 | Set the default TLS minimum to TLSv1.2 | help |
--tls-min-v1.3 | Set the default TLS minimum to TLSv1.3 | help |
--tls-max-v1.2 | Set the default TLS maximum to TLSv1.2 | help |
--tls-max-v1.3 | Set the default TLS maximum to TLSv1.3 | help |
--redis-preconnect | Preconnect to $REDIS_URL at startup | help |
--sql-preconnect | Preconnect to PostgreSQL at startup | help |
--no-addons | Throw an error if process.dlopen or bun:ffi cc() is called, and disable export condition "node-addons" | help |
--no-ffi-cc | Throw an error if bun:ffi cc() is called (disables the C compiler) | help |
--unhandled-rejections val | One of "strict", "throw", "warn", "none", or "warn-with-error-code" | help |
--console-depth val | Set the default depth for console.log object inspection (default: 2) | help |
--user-agent val | Set the default User-Agent header for HTTP requests | help |
--cron-title val | Title for cron execution mode | help |
--cron-period val | Cron period for cron execution mode | help |
--main-fields val | Main fields to lookup in package.json. | help |
--preserve-symlinks | Preserve symlinks when resolving files | help |
--preserve-symlinks-main | Preserve symlinks when resolving the main entry point | help |
--extension-order val | Defaults to: .tsx,.ts,.jsx,.js,.json | help |
--tsconfig-override val | Specify custom tsconfig.json. | help |
-d, --define val | Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:"development". | help |
--drop val | Remove function calls, e.g. --drop=console removes all console.* calls. | help |
--feature val | Enable a feature flag for dead-code elimination, e.g. --feature=SUPER_SECRET | help |
-l, --loader val | Parse files with .ext:loader, e.g. --loader .js:jsx. | help |
--no-macros | Disable macros from being executed in the bundler, transpiler and runtime | help |
--jsx-factory val | Changes the function called when compiling JSX elements using the classic JSX runtime | help |
--jsx-fragment val | Changes the function called when compiling JSX fragments | help |
--jsx-import-source val | Declares the module specifier to be used for importing the jsx and jsxs factory functions. | help |
--jsx-runtime val | "automatic" (default) or "classic" | help |
--jsx-side-effects | Treat JSX elements as having side effects (disable pure annotations) | help |
--ignore-dce-annotations | Ignore tree-shaking annotations such as @__PURE__ | help |
--env-file val | Load environment variables from the specified file(s) | help |
--no-env-file | Disable automatic loading of .env files | help |
--cwd val | Absolute path to resolve files & entry points from. | help |
-c, --config val | Specify path to Bun config file. | help |
-h, --help | Display this menu and exit | help |