Skip to main content
Remove a globally-linked package.

Behavior

bun unlink removes a package from the global link registry. Run bun unlink (no arguments) in a package directory to remove its global registration:
This removes the global link so other projects can no longer link to it.

Examples

The package is removed from the global registry. Other projects using bun link my-utils will no longer work until the package is re-linked.

What gets removed

When unlinking a package, Bun:
  1. Removes the symlink from global node_modules
  2. Removes any global bin links
  3. Leaves existing project links intact

Remove from a project

To remove a linked package from a specific project (without unlinking globally), use bun remove:

Flags

--cwd <path>

Run command in specified directory.

--global-dir <path>

Use a custom global directory.

Re-linking

To re-link a package after unlinking:

Global bin directory

Globally-linked binaries are stored in:
  • macOS/Linux: ~/.bun/install/global/bin
  • Windows: %USERPROFILE%\.bun\install\global\bin
Unlinking removes binaries from this directory.

Use cases

Clean up after development

Switch to published version

If a package link is broken:

Common issues

Package not linked

If running bun unlink shows “package is not globally linked”:
The package wasn’t linked globally. This is not an error.

Projects still reference the package

Unlinking doesn’t automatically remove the package from projects using it. You must manually remove it:

See also