Bun installieren: macOS/Linux, bun init, TypeScript, bun install vs npm

Mit Bun: bun init, bun install, TypeScript ohne ts-node.

Small APIs, CLIs, and front-end scripts still pay a tax: wire up ts-node, wait on npm installs, add a bundler. Bun is an all-in-one JavaScript/TypeScript runtime, package manager, test runner, and bundler — documented at bun.sh/docs.

Suche Bun installieren macOS Linux bun init TypeScript bun install npm need: install the Bun CLI, scaffold with bun init, execute .ts files directly, install deps with bun install, and understand how that differs from npm. Steps follow the official docs.

Install Bunbun init · run TSbun install · vs npm

Für wen Bun passt

01

JS/TS devs who want fewer moving parts

One binary runs scripts, installs packages, and runs tests — small services without webpack + ts-node first.

02

Teams staying on npm packages

bun install reads package.json; most npm libraries work. Lockfile is bun.lockb — commit it when Bun is canonical.

03

Fast local dev, Node in production

Use Bun locally for speed; ship on Node LTS in CI/production if required — document which runtime owns each repo.

Install Bun (macOS / Linux)

  1. 1

    Official installer

    Run the Installation command from the docs, e.g. curl -fsSL https://bun.sh/install | bash. Open a new terminal and check bun --version.

  2. 2

    macOS: Homebrew

    brew tap oven-sh/bun then brew install bun when documented. Pick one install method to avoid duplicate binaries on PATH.

  3. 3

    Linux / WSL

    Prefer the official script; verify with which bun and bun --version. Locked-down hosts may need vendor packages from the docs.

  4. 4

    Upgrade

    bun upgrade for latest stable (see CLI docs). Pin CI images when you upgrade.

Scaffold with bun init

  1. 1

    Interactive setup

    mkdir my-app && cd my-app, then bun init. Choose blank, React, or other templates when prompted.

  2. 2

    Non-interactive

    bun init -y for a minimal package.json and entry index.ts — confirm flags with bun init --help.

  3. 3

    Check entrypoints

    Review package.json type and scripts; bun run uses them like npm.

Run TypeScript without extra tooling

bun run index.ts
bun index.ts
bun run dev

Bun transpiles TypeScript/JSX built-in. Native Node addons and rare APIs may still differ — run your test suite before switching production runtime.

bun install vs npm

TasknpmBun
installnpm installbun install
add packagenpm install pkgbun add pkg
run scriptnpm run devbun run dev
lockfilepackage-lock.jsonbun.lockb

bun install is usually faster (see Package manager docs). Repos with package-lock.json can trial Bun on a branch before adopting bun.lockb.

Bun speeds local installs and TS execution; Dockerfiles that use node:22 still need an explicit Node base — Bun and Node images are not drop-in replacements.

Pair on package.json or CI from the wbroom homepage — Raum erstellen und beitreten.

Questions worth checking

Can Bun replace Node everywhere?

Depends on the app. Many npm packages work; native addons and edge APIs may not. Validate against the compatibility docs and your tests.

Keep both lockfiles?

Avoid two sources of truth. Pick Bun (bun.lockb + bun install --frozen-lockfile) or npm — document it in the README.

Windows?

This guide targets macOS/Linux. See Installation on bun.sh for Windows/WSL guidance.

Bun vs mise vs pnpm?

mise pins runtimes; pnpm optimizes Node installs; Bun bundles runtime + PM. Existing pnpm monorepos need a deliberate migration — greenfield scripts are easier to start on Bun.

Meeting starten