OS Manuals

/usr/lib/ghc-9.14.1/bin/ghc-pkg

Glasgow Haskell Compiler

From ghc-9.14 9.14.1-r3 (enterprise-packages), captured 2026-11-08 by running ghc-pkg --help (exit 0). permalink

Usage:
  ghc-pkg init {path}
    Create and initialise a package database at the location {path}.
    Packages can be registered in the new database using the register
    command with --package-db={path}.  To use the new database with GHC,
    use GHC's -package-db flag.

  ghc-pkg register {filename | -}
    Register the package using the specified installed package
    description. The syntax for the latter is given in the ghc-pkg
    documentation.  The input file should be encoded in UTF-8.

  ghc-pkg update {filename | -}
    Register the package, overwriting any other package with the
    same name. The input file should be encoded in UTF-8.

  ghc-pkg unregister [pkg-id]
    Unregister the specified packages in the order given.

  ghc-pkg expose {pkg-id}
    Expose the specified package.

  ghc-pkg hide {pkg-id}
    Hide the specified package.

  ghc-pkg trust {pkg-id}
    Trust the specified package.

  ghc-pkg distrust {pkg-id}
    Distrust the specified package.

  ghc-pkg list [pkg]
    List registered packages in the global database, and also the
    user database if --user is given. If a package name is given
    all the registered versions will be listed in ascending order.
    Accepts the --simple-output flag.

  ghc-pkg 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: ghc-pkg dot | tred | dot -Tpdf >pkgs.pdf

  ghc-pkg find-module {module}
    List registered packages exposing module {module} in the global
    database, and also the user database if --user is given.
    All the registered versions will be listed in ascending order.
    Accepts the --simple-output flag.

  ghc-pkg latest {pkg-id}
    Prints the highest registered version of a package.

  ghc-pkg check
    Check the consistency of package dependencies and list broken packages.
    Accepts the --simple-output flag.

  ghc-pkg describe {pkg}
    Give the registered description for the specified package. The
    description is returned in precisely the syntax required by ghc-pkg
    register.

  ghc-pkg field {pkg} {field}
    Extract the specified field of the package description for the
    specified package. Accepts comma-separated multiple fields.

  ghc-pkg dump
    Dump the registered description for every package.  This is like
    "ghc-pkg describe '*'", except that it is intended to be used
    by tools that parse the results, rather than humans.  The output is
    always encoded in UTF-8, regardless of the current locale.

  ghc-pkg 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 manually.  By default, the global DB
    is recached; to recache a different DB use --user or --package-db
    as appropriate.

 Substring matching is supported for {module} in find-module and
 for {pkg} in list, describe, and field, where a '*' indicates
 open substring ends (prefix*, *suffix, *infix*).  Use --ipid to
 match against the installed package ID instead.

  When asked to modify a database (register, unregister, update,
  hide, expose, and also check), ghc-pkg modifies the global database by
  default.  Specifying --user causes it to act on the user database,
  or --package-db 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, tree, latest, describe,
  field) operate on the list of databases specified by the flags
  --user, --global, and --package-db.  If none of these flags are
  given, the default is --global --user.

 The following optional flags are also accepted:

                 --user                   use the current user's package database
                 --global                 use the global package database
  -f FILE/DIR    --package-db=FILE/DIR    use the specified package database
                 --package-conf=FILE/DIR  use the specified package database (DEPRECATED)
                 --global-package-db=DIR  location of the global package database
                 --no-user-package-db     never read the user package database
                 --user-package-db=DIR    location of the user package database (use instead of default)
                 --no-user-package-conf   never read the user package database (DEPRECATED)
                 --force                  ignore missing dependencies, directories, and libraries
                 --force-files            ignore missing directories and libraries only
                 --enable-multi-instance  allow registering multiple instances of the same package version
                 --expand-env-vars        expand environment variables (${name}-style) in input package descriptions
                 --expand-pkgroot         expand ${pkgroot}-relative paths to absolute in output package descriptions
                 --no-expand-pkgroot      preserve ${pkgroot}-relative paths in output package descriptions
  -?             --help                   display this help and exit
  -V             --version                output version information and exit
                 --simple-output          print output in easy-to-parse format for some commands
                 --show-unit-ids          print unit-ids instead of package identifiers
                 --names-only             only print package names, not versions; can only be used with list --simple-output
                 --ignore-case            ignore case for substring matching
                 --ipid, --unit-id        interpret package arguments as unit IDs (e.g. installed package IDs)
  -v[Verbosity]  --verbose[=Verbosity]    verbosity level (0-2, default 1)
Options (5)
OptionDescriptionSource
--user, --globalIf none of these flags arehelp
-f FILE/DIR--package-db=FILE/DIR use the specified package databasehelp
-?--help display this help and exithelp
-V--version output version information and exithelp
-v Verbosity--verbose[=Verbosity] verbosity level (0-2, default 1)help

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.