How do you fix this?

$ brew doctor
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built.

  • For future users -> this is automated script apple.stackexchange.com/a/125319/53973 Mar 13, 2016 at 5:52
  • It would be nice to understand why this typically happens. For software installations managed 100% through brew, how do kegs become unlinked in the first place?
    – jarmod
    Sep 7, 2022 at 15:49

3 Answers 3


Like this, for each unlinked keg:

brew link imagemagick

If you don't want to keep them, brew cleanup should get rid of them.

  • 7
    What if I have removed those 'kegs' previously? Why are they still there? I don't want to 'link' them again, I want to get rid of them. Jan 8, 2013 at 21:30
  • 9
    brew cleanup will get rid of unused stuff Oct 25, 2013 at 9:25
  • @PeterŠtibraný I also didn’t want to link to the unlinked version of something I already had via brew (no idea) so brew cleanup then brew upgrade and another (possibly excessive tidying) `brew cleanup worked for me. Aug 2, 2023 at 10:56

i ran below command and the problem is gone...

"brew upgrade"

  • 1
    That worked for me too, good catch.
    – dsomnus
    Oct 20, 2017 at 14:40
brew link --overwrite imagemagick

repeat it for each and it will solve the issue

You must log in to answer this question.

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