bun-rm
Uninstall Bun package dependencies
TLDR
View documentation for the original command
SYNOPSIS
bun rm [options] <packages...>
alias: bun remove
PARAMETERS
<packages...>
Required: one or more package names to remove
--dev
Remove from devDependencies
--peer
Remove from peerDependencies
--optional
Remove from optionalDependencies
-g, --global
Remove packages globally (~/.bun)
--dry-run
Preview changes without modifying files
DESCRIPTION
The bun rm (or bun remove) command is part of the Bun toolkit, a fast all-in-one JavaScript runtime and package manager. It removes specified packages from your package.json file and corresponding directories in node_modules, ensuring your project stays lean. Bun performs these operations swiftly using its native-speed linker and lockfile system (bun.lockb).
By default, it targets dependencies, but flags allow precise control over sections like devDependencies or peerDependencies. The command atomically updates files, prunes unused code, and handles transitive dependencies efficiently. Ideal for JavaScript/TypeScript workflows, it's a drop-in replacement for slower alternatives like npm uninstall.
Usage integrates seamlessly with Bun's ecosystem: run after bun install to clean up, or combine with bun add for dependency management. Always commit package.json and bun.lockb changes to version control.
CAVEATS
Requires existing package.json. Modifies bun.lockb and node_modules. Global ops need write perms to ~/.bun. Won't remove unmanaged files.
EXAMPLES
bun rm lodash — Removes from dependencies.
bun rm --dev jest react-dom — Removes from devDependencies.
bun rm -g cowsay — Global removal.
OUTPUT
Shows removed packages, updated lockfile, and node_modules savings (e.g. "Saved 2.3MB").
HISTORY
Introduced in Bun v0.1.0 (Sep 2022) by Jarred Sumner. Evolved with Bun's package manager for speed matching Zig/C++ installs. v1.0+ added peer/optional support.


