user3641668
user3641668

Reputation: 29

How to install Cabal

I have downloaded the cabal-install-1.20.0.1.tar.gz directory. But am unsure what to do with it? Opening it up there is just a bunch of files, there is no installer etc. I found an old guide but it is from 2011 and is now obsolete, any help?

Upvotes: 2

Views: 2310

Answers (2)

Daniel Wagner
Daniel Wagner

Reputation: 152682

There should be a file named bootstrap.sh in the tarball. Run it to install cabal-install.

Upvotes: 1

nomen
nomen

Reputation: 3715

How you install Cabal depends on how your system is set up. Cabal definitely requires a working compiler to install. So you have a few options, and some of them are more preferred than others:

If you don't have a compiler, get GHC and the Haskell Platform. The Haskell Platform is a collection of important and useful libraries for Haskell. The Haskell Platform is the "batteries included" distribution -- this is the one you want if you want your Haskell system to "just work."

If you already have a compiler, but you don't have Cabal, you can install Cabal by running the bootstrap.sh script in the tar file you downloaded. You can also do it by running:

runhaskell Setup configure --user
runhaskell Setup build
runhaskell Setup install

inside the cabal-1.20 directory. Notice that I passed in a --user flag. This lets you install Cabal just for your user. If you are unable to install to the system, you will want to use this last option.

I am not actually sure that Cabal 1.20 will install with a compiler as old as GHC-7.4.1. If it doesn't work, you can actually get GHC-7.6.3 (or even 7.8) installed in your user directory. The GHC binary linux installer uses the configure/make/install system, so you can pass in a --prefix. If you go this route, I would advise using your new GHC to build the Haskell Platform (which also accepts a --prefix option). So doing that would look something like:

<download ghc-7.6.3 tar file from http://www.haskell.org/ghc/download_ghc_7_6_3#x86linux>
<untar the ghc tar file>
$ cd <the ghc directory>
$ ./configure --prefix=$HOME
$ make install
$ cd ..
<download haskell platform source from http://www.haskell.org/platform/download/2013.2.0.0/haskell-platform-2013.2.0.0.tar.gz>
<untar the haskell platform tar file>
$ cd <the haskell-platform directory>
$ ./configure --prefix=$HOME
$ make
$ make install

And then you would have to edit your path so that "$HOME/bin/" comes before "/bin"

Upvotes: 2

Related Questions