Blob Blame Raw
.TH ghc-pkg 1 "2010-01-27"
ghc-pkg \- GHC Haskell Cabal package manager
.B ghc-pkg
.I action
.RI [ OPTION ]...
A package is a library of Haskell modules known to the compiler.  The
.B ghc-pkg
tool allows adding or removing them from a package database. By
default, the system-wide package database is modified, but
alternatively the user's local package database or another specified
file can be used.
To make a package available for
.BR ghc ,
.B ghc-pkg
can be used to register it.  Unregistering it removes it from the
database.  Also, packages can be hidden, to make
.B ghc
ignore the package by default, without uninstalling it.  Exposing a
package makes a hidden package available.  Additionally,
.B ghc-pkg
has various commands to query the package database.
Where a package name is required, the package can be named in full
including the version number (e.g.
.BR network-1.0 ),
or without the version number. Naming a package without the version
number matches all versions of the package; the specified action will
be applied to all the matching packages. A package specifier that
matches all version of the package can also be written
.BR pkg-* ,
to make it clearer that multiple packages are being matched.
\fBregister\fP \fIfilename\fP|\fB-\fP
Register the package using the specified installed package
\fBupdate\fP \fIfilename\fP|\fB-\fP
Register the package, overwriting any other package with the same
\fBunregister\fP \fIpkg-id\fP
Unregister the specified package.
\fBexpose\fP \fIpkg-id\fP
Expose the specified package.
\fBhide\fP \fIpkg-id\fP
Hide the specified package
\fBlist\fP \fR[\fIpkg\fR]...\fP
List registered packages in the global database, and also the user
database if
.B --user
is given. If a package name is given all the registered versions will
be listed in ascending order.  Accepts the
.B --simple-output
.B dot
Generate a graph of the package dependencies in a form suitable for
input for the graphviz tools.  For example, to generate a PDF of the
dependency graph:
\fB    dot \| tred \| dot -Tpdf >pkgs.pdf\fP
\fBfind-module\fP \fImodule\fP
List registered packages exposing module
.I module
in the global database, and also the user database if
.B --user
is given. All the registered versions will be listed in ascending
order.  Accepts the
.B --simple-output
\fBlatest\fP \fIpkg-id\fP
Prints the highest registered version of a package.
.B check
Check the consistency of package dependencies and list broken
packages.  Accepts the
.B --simple-output
\fBdescribe\fP \fIpkg\fP
Give the registered description for the
specified package. The description is returned in precisely the syntax
required by ghc-pkg register.
\fBfield\fP \fIpkg field\fP
Extract the specified field of the package description for the
specified package.  Accepts comma-separated multiple fields.
.B dump
Dump the registered description for every package. This is like
.BR ghc-pkg\ describe\ '*' ,
expect that it is intended to be used by tools that parse the results,
rather than humans.
.B recache
Regenerate the package database cache.  This command should only be
necessary if you added a package to the database by dropping a file
into the database directory manyally.  By default, the global DB is
recached; to recache a different DB use
.B --user
.B --package-conf
as appropriate.
When asked to modify a database
.RB ( register ,\  unregister ,\  update ,\  hide ,\  expose ,\ and\ also\  check ),
.B ghc-pkg
modifies the global database by
default.  Specifying
.B --user
causes it to act on the user database,
.B --package-conf
can be used to act on another database
entirely. When multiple of these options are given, the rightmost
one is used as the database to act upon.
Commands that query the package database
.RB ( list ,\  latest ,\  describe ,\  field )
operate on the list of databases specified by the flags
.BR --user ,\  --global ,
.BR --package-conf .
If none of these flags are
given, the default is
.BR --global\ --user .
.B --user
Use the current user's package database.
.B --global
Use the global package database.
\fB-f\fP \fIFILE\fP, \fB--package-conf=\fIFILE\fP
Use the specified package config file.
.BI --global-conf= FILE
Location of the global package config.
.B --force
Ignore missing dependencies, directories, and libraries.
.B --force-files
Ignore missing directories and libraries only.
.BR -g ,\  --auto-ghc-libs
Automatically build libs for GHCi (with register).
.BR -? ,\  --help
Display a help message and exit.
.BR -V ,\  --version
Output version information and exit.
.B --simple-output
Print output in easy-to-parse format for some commands.
.B --names-only
Only print package names, not versions; can only be used with
.BR list\ --simple-output .
.B --ignore-case
Ignore case for substring matching.
environment variable may be set to a
.BR : -separated
list of files containing package databases. This list of package
databases is used by
.B ghc
.BR ghc-pkg ,
with earlier databases in the list overriding later ones. This order
was chosen to match the behaviour of the
environment variable; think of it as a list of package databases that
are searched left-to-right for packages.

ends in a separator, then the default user and system package
databases are appended, in that order. e.g. to augment the usual set
of packages with a database of your own, you could say:

\fB     export GHC_PACKAGE_PATH=$HOME/.my-ghc-packages.conf:\fP

To check whether your
setting is doing the right thing,
.B ghc-pkg list
will list all the databases in use, in the reverse order they are
Both of these locations are changed for Debian.  Upstream still keeps
these under
.IR /usr .
Some programs may refer to that, but look in
.I /var
.I /var/lib/ghc/package.conf
Global package.conf file.
.I /var/lib/ghc/package.conf.d/
Directory for library specific package.conf files.  These are added to
the global registry.
.BR ghc (1),
.BR runghc (1),
.BR hugs (1).
This manual page was written by Kari Pahula <>, for the
Debian project (and may be used by others).