Run brew unlink OLD-VERSION
then brew link NEW_VERSION
Looks like only symlinks are created or removed not actually files. So lib will not be removed, but it will not be at that symlinked location anymore (at least with this method).
After running each command it will tell you how many symlinks are created or removed.
from man brew
:
unlink formula:
Remove symlinks for formula from the Homebrew prefix. This can be useful for temporarily disabling a formula: brew unlink
foo && commands && brew link foo.
ln, link [--overwrite] [--dry-run] [--force] formula
Symlink all of formula's installed files into the Homebrew prefix. This is done automatically when you install formula,
but can be useful for DIY installations.
If --overwrite is passed, Homebrew will delete files which already exist in the prefix while linking.
If --dry-run or -n is passed, Homebrew will list all files which would be linked or which would be deleted by brew link
--overwrite, but will not actually link or delete any
files.
If --force is passed, Homebrew will allow keg-only formulae to be linked.
Also found this: How can I brew link a specific version?