Apple - packages installed with Homebrew not found after restore
From your answer above, it looks like you want to relink all your kegs, which is already answered here:
Is there a quick way to relink my homebrew kegs?
In one line:
brew list -1 | while read line; do brew unlink $line; brew link $line; done
It is documented that Homebrew fails after TimeMachine recovery a on a new Mac or making a Migration as Homebrew builds binaries for your specific machine: https://github.com/Homebrew/brew/issues/583
The official solution is to uninstall and reinstall homebrew. Don´t cry it's very easy with this line that remove and restore again all your 'formulae'
brew bundle dump && brew uninstall --force $(brew list); brew bundle