LinuxCommandLibrary

bun-rm

Uninstall Bun package dependencies

TLDR

View documentation for the original command

$ tldr bun remove
copy

SYNOPSIS

bun rm [options] <packages...>

PARAMETERS

<packages...>
    One or more package names to remove. These are the names as listed in your package.json.

-D, --dev
    Removes the specified packages from the devDependencies section in package.json.

-O, --optional
    Removes the specified packages from the optionalDependencies section in package.json.

-P, --peer
    Removes the specified packages from the peerDependencies section in package.json.

--dry-run
    Performs a simulated removal without actually modifying package.json, bun.lockb, or node_modules. Useful for previewing changes.

-f, --force
    Forces the removal of packages, potentially ignoring some checks or warnings.

-h, --help
    Displays help information for the bun rm command.

DESCRIPTION

bun rm is a fundamental command within the Bun JavaScript runtime's package manager, designed to efficiently remove dependencies from your project.

When executed, it updates your project's package.json file by removing the specified packages from the relevant dependency sections (e.g., dependencies, devDependencies, optionalDependencies). Concurrently, it modifies the bun.lockb lockfile, ensuring consistency and reproducibility across installations. This process also typically triggers a re-resolution of the dependency tree and prunes the node_modules directory, effectively freeing up disk space and cleaning up unused packages.

It serves as Bun's counterpart to npm uninstall or yarn remove, offering a fast and robust way to manage your project's dependency footprint, making it easier to maintain lean and optimized applications.

CAVEATS

bun rm primarily operates on project-local dependencies defined in package.json. It does not directly manage globally installed Bun executables or modules in the same way npm uninstall -g does for Node.js.

The command requires the Bun runtime to be installed and accessible in your system's PATH.

Changes made by bun rm are reflected in package.json and bun.lockb. Always commit these files to version control after making dependency changes.

USAGE EXAMPLES

To remove a single package:
bun rm lodash

To remove multiple packages simultaneously:
bun rm react vue

To remove a package specifically from devDependencies:
bun rm -D webpack

To see what would be removed without actually doing it:
bun rm some-package --dry-run

HISTORY

bun rm has been an integral part of the Bun JavaScript runtime since its early development. Bun, created by Jarred Sumner, emerged with a strong focus on speed and all-in-one tooling for web development. The rm command embodies this philosophy by providing a fast and efficient way to manage project dependencies, mirroring the functionality of established package managers like npm and Yarn but with Bun's native performance advantages. Its design ensures compatibility with existing Node.js package ecosystems while leveraging Bun's internal architecture for rapid dependency resolution and file system operations.

SEE ALSO

bun install(1), bun add(1), bun update(1), bun(1), npm uninstall(1), yarn remove(1)

Copied to clipboard