Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Unlinked kegs in your Cellar". How do I remove them?

After installing and uninstalling some programs through brew and brew cask, now I get brew doctor saying "unlinked kegs in your Cellar".

It suggests to link them, to avoid build trouble with later brews, but instead I'd rather delete them, as they're leftovers from brew programs or formulas that I don't use anymore.

How or where do I remove these? (I don't even know what a keg, or the Cellar, is)

like image 849
RocketNuts Avatar asked Jun 22 '15 09:06

RocketNuts


3 Answers

Run: brew remove packageName for each unlinked package.

like image 153
k3liutZu Avatar answered Oct 29 '22 21:10

k3liutZu


2018 Update

$ brew link --help
    If --overwrite is passed, Homebrew will delete files which already exist
    in the prefix while linking.
$ brew link --overwrite [package]
$ brew doctor
like image 38
JBallin Avatar answered Oct 29 '22 21:10

JBallin


running brew link will bring up optional commands that you can use, along with that you'll need an argument to go with it or it'll prompt you with an error saying just that.

so I would suggest running:

  • brew doctor

    This will give you the:
    'Warning: You have unlinked kegs in your Cellar...'
    message

    underneath this message it will prompt which kegs are there with the potential problem. My personal warning was:

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. Run `brew link` on these: mongodb

  • brew link

    read your options, so you understand what is happening with this command.

  • brew link --dry-run <yourArgument>

    Homebrew will list all files which would be linked or which would be deleted by brew link --overwrite, but will not actually link or delete any files.

  • brew link --overwrite <yourArgument>

    This will execute what the dry-run did, for real this time.

    My experience with this was:
    cli cmnd:brew link --overwrite mongodb
    cli response: Linking /usr/local/Cellar/mongodb/3.2.7... 0 symlinks created

  • brew doctor Finally I ran this command and my response no longer had issues.

    cli response: Your system is ready to brew.

    I figure it will either make the link or if there is none to be had it will just delete the file; which was a previous solution above (this just seems to follow the brew cli prompts vs. just "smashing" the issue with a hammer).

    I hope this helps you!


  • don't cry over spilt code, keep supporting the community.
like image 13
Carl Avatar answered Oct 29 '22 21:10

Carl