Behavior
bun unlink removes a package from the global link registry.
Unlink current package
Runbun unlink (no arguments) in a package directory to remove its global registration:
Examples
Unlink a package
bun link my-utils will no longer work until the package is re-linked.
What gets removed
When unlinking a package, Bun:- Removes the symlink from global node_modules
- Removes any global bin links
- Leaves existing project links intact
Remove from a project
To remove a linked package from a specific project (without unlinking globally), usebun 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
Use cases
Clean up after development
Switch to published version
Resolve link conflicts
If a package link is broken:Common issues
Package not linked
If runningbun unlink shows “package is not globally linked”:
Projects still reference the package
Unlinking doesn’t automatically remove the package from projects using it. You must manually remove it:See also
- bun link - Link packages
- bun remove - Remove packages from a project