title: How do you set up Haskell + ghc-mod on OS/X?
body: <p>I first set up Haskell from <a href="https://www.haskell.org/platform/" rel="nofollow noreferrer">https://www.haskell.org/platform/</a> but ghc-mod had problems with sandboxes and to update it I needed a newer cabal which needed a newer ghc. Or something like that. (<a href="https://stackoverflow.com/a/28049104/131227">https://stackoverflow.com/a/28049104/131227</a> ??)</p>
  
  <p>So I deleted everything, and installed from <a href="http://ghcformacosx.github.io/" rel="nofollow noreferrer">http://ghcformacosx.github.io/</a>.
  Then some strange failure setting up a new sandbox was because something didn't properly have a dependancy for happy. (<a href="https://github.com/haskell-suite/haskell-src-exts/issues/14" rel="nofollow noreferrer">https://github.com/haskell-suite/haskell-src-exts/issues/14</a>)</p>
  
  <p>Ok. Installed happy. Now trying (again) to install ghc-mod and I get a giant mess (below).</p>
  
  <p>Should I use <a href="http://www.stackage.org/" rel="nofollow noreferrer">http://www.stackage.org/</a>?<br>
  I've seen some people mention <code>ghc-pkg recache</code> or <code>cabal install cabal-install</code>... Are those things I need to do? </p>
  
  <p>Mess:</p>
  
  <pre><code>Resolving dependencies... Configuring ghc-mod-5.2.1.2... Building ghc-mod-5.2.1.2... Failed to install ghc-mod-5.2.1.2 Build log ( /Users/mark/.cabal/logs/ghc-mod-5.2.1.2.log ): Configuring ghc-mod-5.2.1.2... Building ghc-mod-5.2.1.2... Preprocessing library ghc-mod-5.2.1.2...
  
  Language/Haskell/GhcMod/Convert.hs:1:51: Warning:
      -XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS [ 1 of 38] Compiling Language.Haskell.GhcMod.Read ( Language/Haskell/GhcMod/Read.hs, dist/build/Language/Haskell/GhcMod/Read.o ) [ 2 of 38] Compiling Language.Haskell.GhcMod.Cabal21 ( Language/Haskell/GhcMod/Cabal21.hs, dist/build/Language/Haskell/GhcMod/Cabal21.o ) [ 3 of 38] Compiling Language.Haskell.GhcMod.Cabal18 ( Language/Haskell/GhcMod/Cabal18.hs, dist/build/Language/Haskell/GhcMod/Cabal18.o ) [ 4 of 38] Compiling Language.Haskell.GhcMod.Cabal16 ( Language/Haskell/GhcMod/Cabal16.hs, dist/build/Language/Haskell/GhcMod/Cabal16.o ) [ 5 of 38] Compiling Language.Haskell.GhcMod.GHCChoice ( Language/Haskell/GhcMod/GHCChoice.hs, dist/build/Language/Haskell/GhcMod/GHCChoice.o ) [ 6 of 38] Compiling Language.Haskell.GhcMod.Error ( Language/Haskell/GhcMod/Error.hs, dist/build/Language/Haskell/GhcMod/Error.o )
  
  Language/Haskell/GhcMod/Error.hs:12:1: Warning:
      Module ‘Control.Monad.Error’ is deprecated:
        Use Control.Monad.Except instead
  
  Language/Haskell/GhcMod/Error.hs:40:10: Warning:
      In the use of type constructor or class ‘Error’
      (imported from Control.Monad.Error, but defined in Control.Monad.Trans.Error):
      Deprecated: "Use Control.Monad.Trans.Except instead"
  
  Language/Haskell/GhcMod/Error.hs:40:10: Warning:
      In the use of type constructor or class ‘Error’
      (imported from Control.Monad.Error, but defined in Control.Monad.Trans.Error):
      Deprecated: "Use Control.Monad.Trans.Except instead" [ 7 of 38] Compiling Language.Haskell.GhcMod.Utils ( Language/Haskell/GhcMod/Utils.hs, dist/build/Language/Haskell/GhcMod/Utils.o )
  
  Language/Haskell/GhcMod/Utils.hs:15:1: Warning:
      The import of ‘Control.Applicative’ is redundant
        except perhaps to import instances from ‘Control.Applicative’
      To import instances alone, use: import Control.Applicative()
  
  Language/Haskell/GhcMod/Utils.hs:45:51: Warning:
      In the use of ‘strMsg’
      (imported from Language.Haskell.GhcMod.Error, but defined in Control.Monad.Trans.Error):
      Deprecated: "Use Control.Monad.Trans.Except instead" [ 8 of 38] Compiling Language.Haskell.GhcMod.Types ( Language/Haskell/GhcMod/Types.hs, dist/build/Language/Haskell/GhcMod/Types.o ) [ 9 of 38] Compiling Language.Haskell.GhcMod.Gap ( Language/Haskell/GhcMod/Gap.hs, dist/build/Language/Haskell/GhcMod/Gap.o )
  
  Language/Haskell/GhcMod/Gap.hs:256:18:
      Not in scope: data constructor ‘ExposePackageId’
      Perhaps you meant ‘ExposePackage’ (imported from DynFlags) cabal: Error: some packages failed to install: ghc-mod-5.2.1.2 failed during the building phase. The exception was: ExitFailure 1
  </code></pre>
  
  <p>After applying the accepted answer (which seemed to install ghc-mod), running gch-mod gives the following:</p>
  
  <pre><code>&gt; ghc-mod check x.hs
  cabal-helper-wrapper: Installing a private copy of Cabal, this might take a
  while but will only happen once per Cabal version.
  
  If anything goes horribly wrong just delete this directory and try again:
      /Users/mark/.ghc-mod/cabal-helper
  
  If you want to avoid this automatic installation altogether install version
  1.22.0.0 of Cabal manually (into your user or global package-db):
      $ cabal install Cabal-1.22.0.0
  ...In order, the following would be installed:
  filepath-1.3.0.1 (latest: 1.4.0.0) (new version)
  directory-1.2.2.1 (new version)
  process-1.2.3.0 (reinstall) changes: directory-1.2.2.0 -&gt; 1.2.2.1,
  filepath-1.4.0.0 -&gt; 1.3.0.1
  Cabal-1.22.0.0 (latest: 1.22.2.0) (new version)
  cabal: The following packages are likely to be broken by the reinstalls:
  ghc-7.10.1
  Cabal-1.22.2.0
  Use --force-reinstalls if you want to install anyway.
  cabal-helper-wrapper: Installing Cabal version 1.22.0.0 failed.
  nYou have two choices now:
  - Either you install this version of Cabal in your globa/luser package-db
    somehow
  n- Or you can see if you can update your cabal-install to use a different
    version of the Cabal library that we can build with:
      $ cabal install cabal-install --constraint 'Cabal &gt; 1.22.0.0'
  nTo check the version cabal-install is currently using try:
      $ cabal --version
  
  ghc-mod: readCreateProcess: /Users/mark/.cabal/libexec/cabal-helper-wrapper "/Users/mark/work/haskell/ixberg/dist" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "--with-ghc=ghc" "--with-ghc-pkg=ghc-pkg" "--with-cabal=cabal" (exit 1): failed
  </code></pre>
  
  <p>Strangely, it wants the version of Cabal that is currently installed:</p>
  
  <pre><code>&gt; cabal --version
  cabal-install version 1.22.0.0
  using version 1.22.0.0 of the Cabal library
  </code></pre>