I'm trying to install objective-ocaml on my Mac to compile another application (Unison) I would like to install however I'm getting errors doing so.

    imrans-mac:/ Imran$ 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. Run `brew link` on these:


    imrans-mac:/ Imran$ brew link objective-caml Linking /usr/local/Cellar/objective-caml/4.01.0... Warning: Could not link objective-caml. Unlinking...

    Error: Could not symlink file: /usr/local/Cellar/objective-caml/4.01.0/lib/ocaml/weak.p.cmx Target /usr/local/lib/ocaml/weak.p.cmx already exists. You may need to delete it. To force the link and overwrite all other conflicting files, do:   brew link --overwrite formula_name

    To list all files that would be deleted:   brew link --overwrite
    --dry-run formula_name imrans-mac:/ Imran$ brew link --overwrite objective-ocaml Error: No such keg: /usr/local/Cellar/objective-ocaml

1 Answer 1


First off, run brew doctor. This should clean up any permission errors. Also usually solves most problems.

Note this in the error log:

brew link --overwrite formula_name

Try that in there as well. The big issue here is that the file/folder permissions do not allow you to write or symlink there.

To fix permissions you may need to try this:

sudo chown -R $USER:admin /usr/local

I just tried installing unison as well, no issues on my end.

  • Sorry the formatting of my log is terrible, if you look at the bottom line I have tried the -overwrite argument. It says theres no such keg...
    – Imran
    Oct 28, 2013 at 0:38
  • @Imran Try brew doctor. It should fix permission errors. Also brew update. Uninstall the current builds of unison/objective-caml and make sure the folders are cleared. Oct 28, 2013 at 0:40
  • I have used both brew doctor and brew update, they dont do anything. When using brew rm objective-ocaml it returns No such keg: /usr/local/Cellar/objective-ocaml
    – Imran
    Oct 28, 2013 at 0:43
  • @Imran if you have used sudo before it can mess up permissions. try sudo chown -R $USER:admin /usr/local Oct 28, 2013 at 0:44
  • @Imran did that fix it? Oct 28, 2013 at 1:21

You must log in to answer this question.

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