Skip to content

Old: cabal install

Edward Z. Yang edited this page May 1, 2017 · 1 revision

Imported from Trac wiki; be wary of outdated information or markup mishaps.

Cabal Install

cabal-install is the command-line interface for Cabal.

It provides commands for installing cabal packages, including downloading packages from HackageDB and determining the dependencies among packages. It also provides commands for developers to configure, build, test and upload packages to HackageDB.

Download

Cabal install is included in the haskell platform:

http://hackage.haskell.org/platform/

You can also download it directly from its hackage page:

http://hackage.haskell.org/package/cabal-install

Bugs

Go to the front page for instructions on reporting bugs in Cabal, cabal-install or the hackage site.

Development version

Head branch darcs repositories:

Note: The cabal repo now includes both the Cabal library and the cabal-install tool.

The current development version is quite usable but if you find any surprises please report them in this trac.

Stable branch darcs repository:

This repository contains both the Cabal-1.14 branch and the cabal-install-0.14 branch.

Usage

This program is the command line interface to the Haskell Cabal infrastructure.
See http://www.haskell.org/cabal/ for more information.

Usage: cabal COMMAND [FLAGS]
   or: cabal [GLOBAL FLAGS]

Global flags:
 -h --help            Show this help text
 -V --version         Print version information
    --numeric-version Print just the version number

Commands:
  install      Installs a list of packages.
  update       Updates list of known packages
  list         List packages matching a search string.
  info         Display detailed information about a particular package.
  fetch        Downloads packages for later installation.
  unpack       Unpacks packages for user inspection.
  check        Check the package for common mistakes
  sdist        Generate a source distribution file (.tar.gz).
  upload       Uploads source packages to Hackage
  report       Upload build reports to a remote server.
  init         Interactively create a .cabal file.
  configure    Prepare to build the package.
  build        Make this package ready for installation.
  copy         Copy the files into the install locations.
  haddock      Generate Haddock HTML documentation.
  clean        Clean up after a build.
  hscolour     Generate HsColour colourised code, in HTML format.
  register     Register this package with the compiler.
  test         Run the test suite, if any (configure with UserHooks).
  bench        Run the benchmark, if any (configure with UserHooks).
  upgrade      (command disabled, use install instead)
  help         Help about commands

For more information about a command use:
  cabal COMMAND --help

To install Cabal packages from hackage use:
  cabal install foo [--dry-run]

Occasionally you need to update the list of available packages:
  cabal update

You can edit the cabal configuration file to set defaults:
  $HOME/.cabal/config

See the cabal page for more complete usage information.

Quick Installation on Unix

Note that the preferred ways to obtain cabal-install are:

  • via the Haskell Platform, or
  • via cabal-install (if you already have an older version).

Note also that cabal-install does not have to be built with the same version of GHC as you are intending to use.

If you have a GHC, but no platform and no older version of cabal-install, then you can do the following:

wget http://hackage.haskell.org/packages/archive/cabal-install/0.14.0/cabal-install-0.14.0.tar.gz
tar -zxf cabal-install-0.14.0.tar.gz
cd cabal-install-0.14.0
sh ./bootstrap.sh

You will now have the cabal binary in $HOME/.cabal/bin. You should also add this directory to your $PATH.

In cabal-install 0.6 and later you can get cabal to automatically symlink binaries into another directory, eg $HOME/bin which can be done instead of changing the $PATH. To use this feature edit ~/.cabal/config and see the symlink-bindir field.

Note: cabal-install 0.6 uses a new default ~/.cabal/config file which is somewhat self-documenting in that it lists all the valid (non-deprecated) fields along with their default values. The config file is created once you run a non-trivial cabal command such as cabal update. If you previously used cabal-install 0.5.1 or earlier then you will not see the new format, so you may like to back up your existing config, let cabal-install 0.6 re-create the default config and then merge back any local changes. On Windows the configuration file is named $HOME/Application Data/cabal/config.

Troubleshooting

Storage and Identification of Cabalized Packages: "This article describes where library packages for GHC are stored, how GHC remembers them, and corollaries. Cabal tries to abstract this away from you, but the abstraction leaks. ... This article is Linux-centric." Highly recommended.