Arninja
Arninja

Reputation: 745

Installing Haskell with Homebrew fails

I had installed Haskell before, but that was hopelessly outdated. I tried to uninstall everything based on the documents I found and reinstalled it using homebrew.

brew install ghc cabal-install

This succeeded

==> Downloading https://homebrew.bintray.com/bottles/ghc-7.10.1_1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring ghc-7.10.1_1.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/ghc/7.10.1_1: 5423 files, 821M
==> Downloading https://homebrew.bintray.com/bottles/cabal-install-1.22.2.0.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring cabal-install-1.22.2.0.yosemite.bottle.1.tar.gz
==> Caveats

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/cabal-install/1.22.2.0: 6 files, 19M

But then I get this:

> ghci
-bash: /usr/bin/ghci: No such file or directory

And

> cabal
-bash: /usr/bin/cabal: No such file or directory

Since I can run other packages that are in my Cellar, I would think that I should be able to run these packages as well?

Upvotes: 1

Views: 701

Answers (1)

ase
ase

Reputation: 13471

I think you have some lingering symlinks or similar in /usr/bin. Homebrew automatically symlinks binaries from its "cellar" to /usr/local/bin (notice that the directory includes local).

A reasonable course of action for you might be

  1. Check if Homebrew installed ghc, cabal, etc in /usr/local/bin (they should be symlinks pointing to somewhere under /usr/local/Cellar/). If they do exist you can conclude that Homebrew did not screw up.

  2. Check what kind of thing /usr/bin/ghci, /usr/bin/cabal actually are: eg ls -l /usr/bin/ghci. It will probably tell you that they are symlinks which point to files that don't exist, they are probably left from your previous Haskell installation.

  3. Remove the broken symlinks and make sure that /usr/local/bin is somewhere on your $PATH.

(Now there have been people who do not recommend installing GHC using Homebrew, you might want to try the installation instructions found on the Haskell homepage: https://www.haskell.org/downloads. On the other hand I don't see anything too strange in Homebrew's GHC formula, so it might be fine currently.)

Upvotes: 1

Related Questions