packages installed with Homebrew not found after restore

I got a new Macbook Pro and restored from the backup, all of my packages are in still there and the path is still correct, but when I type a command that was installed on the previous system it returns an error. Take for example pstree

pstree
-bash: pstree: command not found

Someone elsewhere on the internet suggested reinstalling them, but I have way too many packages installed to go thru them one at a time.

The computer is running Mavericks. I used migration assistant to restore from a time machine backup and brew doctor says my system is ready to brew.


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