~/.bun/install/cache. The cache path can be overridden with the BUN_INSTALL_CACHE_DIR environment variable.
Packages are stored in subdirectories named ${name}@${version}, so multiple versions of the same package can coexist in the cache.
Minimizing re-downloads
Bun avoids re-downloading packages whenever possible:- If a version already in the cache satisfies the requested range, Bun uses it directly.
- If a matching version is already installed in
node_modules, Bun skips both the download and the copy.
node_modules by quickly parsing package.json in each package directory to compare name and version — without reading the whole file.
Fast copying into node_modules
After downloading a package into the cache, Bun links it intonode_modules using the fastest syscall available on each platform:
- Linux and Windows: hardlinks — the package files exist in one place on disk and are linked, not copied
- macOS:
clonefile— copy-on-write, so no additional disk space is consumed
--backend flag:
Disk space savings
Because Bun uses hardlinks on Linux/Windows, the package files exist in exactly one location on disk even across many projects. A dependency used by 10 projects takes up the same space as if it were installed once. On macOS,clonefile is copy-on-write — the OS shares the underlying blocks until a file is modified, so disk usage is also minimal in practice.
Cache commands
Print the path to the global cache:Custom cache location
Disabling the cache
To bypass the cache and always resolve the latest versions from the registry:disable = true means Bun will not read from the cache, though it may still write to node_modules/.cache. Setting disableManifest = true forces a fresh resolution on every install.