Errors installing ocaml using homebrew on OS X

1

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:

    objective-caml 

    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

Imran

Posted 2013-10-28T00:26:24.007

Reputation: 307

Answers

2

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.

Simon Sheehan

Posted 2013-10-28T00:26:24.007

Reputation: 8 641

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 – 2013-10-28T00:38:26.453

@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. – Simon Sheehan – 2013-10-28T00:40:39.387

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 – 2013-10-28T00:43:38.937

@Imran if you have used sudo before it can mess up permissions. try sudo chown -R $USER:admin /usr/local – Simon Sheehan – 2013-10-28T00:44:58.690

@Imran did that fix it? – Simon Sheehan – 2013-10-28T01:21:06.430

Yeah the permissions were the issue as I have used sudo before. After fixing permissions I was able to use brew link to fix ocaml and install unison. Thank you! – Imran – 2013-10-28T01:39:57.070