You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This does not work. The linking fails. Here's what happens.
$ brew install mysql
$ brew bundle
Using mysql@8.0
Error: Could not symlink bin/comp_err
Target /opt/homebrew/bin/comp_err
is a symlink belonging to mysql. You can unlink it:
brew unlink mysql
To force the link and overwrite all conflicting files:
brew link --overwrite mysql@8.0
To list all files that would be deleted:
brew link --overwrite mysql@8.0 --dry-run
Linking /opt/homebrew/Cellar/mysql@8.0/8.0.39_1...
Homebrew Bundle complete! 1 Brewfile dependency now installed.
$ echo $?
0
The linking fails. Also brew bundle incorrectly exits with status code 0 for successful execution. This is not true.
The docs reference a -f to force overwriting. This also does not work as expected. The brew link step fails in the same way:
$ brew bundle -f
Using mysql@8.0
Error: Could not symlink bin/comp_err
Target /opt/homebrew/bin/comp_err
is a symlink belonging to mysql. You can unlink it:
brew unlink mysql
To force the link and overwrite all conflicting files:
brew link --overwrite mysql@8.0
To list all files that would be deleted:
brew link --overwrite mysql@8.0 --dry-run
Linking /opt/homebrew/Cellar/mysql@8.0/8.0.39_1...
Homebrew Bundle complete! 1 Brewfile dependency now installed.
$ echo $?
0
Note the command still exits 0 even though a part failed.
The only way to resolve the issue is to manually run brew unlink mysql prior to brew bundle. This apparently defeats the purpose of the link and conflicts_with options.
$ brew unlink mysql
Unlinking /opt/homebrew/Cellar/mysql/9.0.1... 97 symlinks removed.
$ brew bundle
Using mysql@8.0
Homebrew Bundle complete! 1 Brewfile dependency now installed.
$ mysql --version
mysql Ver 8.0.39 for macos14.4 on arm64 (Homebrew)
The console output indicates you already have mysql@8.0 installed (the Using mysql@8.0 line).
Do a brew uninstall mysql@8.0 and then retry the brew bundle step.
The code paths are different for new installs/upgrades vs when already installed.
The link option is processed in all cases, conflicts_with option is only used on new installs/upgrades.
Because mysql@8.0 is already installed, no call to brew unlink mysql is made. Hence the link is in the way when the brew link --force mysql@8.0 step is tried.
The brew link step is only a '--force' and not an '--overwrite'. A new install should call with a --force --overwrite if you pass -f but it looks like there is a very minor bug preventing that (I have a fix i'll PR in the next couple of days).
There is an unfinished PR to add a link: :overwrite option to the Brewfile spec #1116. This would address the already installed case. I'm looking at picking this up.
As to why the exit status code is 0. Well it only cares about whether things are successfully installed. Rightly or wrongly, link and service state failures aren't considered as part of this.
From the docs:
We want
mysql@8.0
installed and linked. So we have this in ourBrewfile
:This does not work. The linking fails. Here's what happens.
The linking fails. Also
brew bundle
incorrectly exits with status code0
for successful execution. This is not true.The docs reference a
-f
to force overwriting. This also does not work as expected. Thebrew link
step fails in the same way:Note the command still exits
0
even though a part failed.The only way to resolve the issue is to manually run
brew unlink mysql
prior tobrew bundle
. This apparently defeats the purpose of thelink
andconflicts_with
options.This issue seems similar to #932.
My Current bundle version
The text was updated successfully, but these errors were encountered: