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

-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.

  • 2
    What OS on the Mac? Did you run brew doctor to make sure your path and the install is clean? You shouldn't need to reinstall the packages - but you might need to explain how you made a backup and how you restored it.
    – bmike
    May 7, 2014 at 20:27
  • Have you tried ls /usr/local/bin and ls /usr/local/Cellar? You should easily be able to see if your brew packages were copied.
    – brennebeck
    May 13, 2014 at 0:48

3 Answers 3


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


I actually found a simple, and somewhat inelegant solution: I concatenated brew list into a file calledbrewback.txt then I wrote and executed the following script

    #! /bin/sh
    cat brewback.txt | xargs -L1 brew unlink ;
    cat brewback.txt | xargs -L1 brew link
    echo "Done" exit

I wanted to do both arguments in the same step, as in unlink then link the first program; unlink then link the second, etc. and if someone can describe how in a comment that would be greatly appreciated, then I will mark this problem as solved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .