Some homebrew formulas broken after migration

I've migrated from an old MacBook Pro to a new one, using Apple's Migration assistant. Some home-brew formulas migrated with no problem, whereas others got broken at the library reference level. Reinstalling them does not help. E.g.:

$ weechat
dyld: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/weechat
  Reason: image not found
Abort trap: 6

But

$ brew install weechat
Warning: weechat 2.2 is already installed and up-to-date
To reinstall 2.2, run `brew reinstall weechat`

Any ideas?


Solution 1:

Had the same problem, what I did was i run

brew list -1 > brew.txt # list out all installed packages
brew list -1 | xargs brew rm --force # remove all installed packages
brew install $(cat brew.txt | tr '\n' ' ') # install all previously installed packages

If everything went fine, remove the package list by:

rm brew.txt

You should probably check potential warnings as well.

Solution 2:

Yes doing the following will fix it

brew uninstall --force gettext
brew install gettext