A package is a library of Haskell modules known to the compiler. The
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
can be used to register it. Unregistering it removes it from the
database. Also, packages can be hidden, to make
ignore the package by default, without uninstalling it. Exposing a
package makes a hidden package available. Additionally,
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.
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
to make it clearer that multiple packages are being matched.
Register the package using the specified installed package
Register the package, overwriting any other package with the same
Unregister the specified package.
Expose the specified package.
Hide the specified package
List registered packages in the global database, and also the user
is given. If a package name is given all the registered versions will
be listed in ascending order. Accepts the
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
dot tred dot -Tpdf >pkgs.pdf
List registered packages exposing module
in the global database, and also the user database if
is given. All the registered versions will be listed in ascending
order. Accepts the
Prints the highest registered version of a package.
Check the consistency of package dependencies and list broken
packages. Accepts the
Give the registered description for the
specified package. The description is returned in precisely the syntax
required by ghc-pkg register.
Extract the specified field of the package description for the
specified package. Accepts comma-separated multiple fields.
Dump the registered description for every package. This is like
ghc-pkg describe '*',
expect that it is intended to be used by tools that parse the results,
rather than humans.
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
When asked to modify a database
(register, unregister, update, hide, expose, and also check),
modifies the global database by
causes it to act on the user database,
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
(list, latest, describe, field)
operate on the list of databases specified by the flags
If none of these flags are
given, the default is
Use the current user's package database.
Use the global package database.
Use the specified package config file.
Location of the global package config.
Ignore missing dependencies, directories, and libraries.
Ignore missing directories and libraries only.
Automatically build libs for GHCi (with register).
Display a help message and exit.
Output version information and exit.
Print output in easy-to-parse format for some commands.
Only print package names, not versions; can only be used with
Ignore case for substring matching.
environment variable may be set to a
list of files containing package databases. This list of package
databases is used by
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: