- Published on
Homebrew link and unlink
In Homebrew, link and unlink control whether a package’s files are symlinked into your main Homebrew prefix (so they’re available on your PATH).
🔗 brew link
Creates symlinks for a package into /usr/local (Intel) or /opt/homebrew (Apple Silicon), making it the active version.
brew link <formula>
Common uses:
- Activate a specific version after installing multiple versions
- Fix “command not found” after install
Example:
brew link python@3.11
🔓 brew unlink
Removes those symlinks, effectively deactivating the package (without uninstalling it).
brew unlink <formula>
Common uses:
- Avoid conflicts between versions
- Temporarily disable a tool
Example:
brew unlink python@3.11
⚖️ Switching between versions
A typical workflow:
brew unlink python@3.12
brew link python@3.11
⚠️ Helpful flags
Force linking even if conflicts exist:
brew link --force <formula>Overwrite conflicting files:
brew link --overwrite <formula>
🧠 Quick mental model
install= download fileslink= make them usableunlink= hide them (but keep installed)