Skip to content

(CI)(macOS) How to fix spurious brew link failures

Erik Martin-Dorel edited this page Oct 20, 2023 · 6 revisions

Comprehensive example:

==> Upgrading tcl-tk
  8.6.13 -> 8.6.13_1 

==> Pouring tcl-tk--8.6.13_1.monterey.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink lib/libtcl8.6.dylib
Target /usr/local/lib/libtcl8.6.dylib
is a symlink belonging to tcl-tk. You can unlink it:
  brew unlink tcl-tk

To force the link and overwrite all conflicting files:
  brew link --overwrite tcl-tk

To list all files that would be deleted:
  brew link --overwrite --dry-run tcl-tk

Possible conflicting files are:
/usr/local/lib/libtcl8.6.dylib -> /usr/local/Cellar/tcl-tk/8.6.13/lib/libtcl8.6.dylib
/usr/local/lib/libtk8.6.dylib -> /usr/local/Cellar/tcl-tk/8.6.13/lib/libtk8.6.dylib

Hence:

  • /usr/local/lib/libtcl8.6.dylib
  • /usr/local/lib/libtk8.6.dylib

Then, add these lines in .ci-macosx.sh:

Finally, commit (chore(macos): Fix `brew upgrade` failure), push, and squash-merge.