ghc-pkg(1)
π ghc-pkg β GHC Haskell Cabal package manager π
okay bestie, sit down, hydrate, because we're about to talk about the <rainbow>package manager for GHC's Haskell Cabal packages. This is from the General Commands Manual, and it's genuinely iconic, no cap.
β¨ SYNOPSIS β¨
ghc-pkg action [OPTION]...
π¦ DESCRIPTION π¦
So, a package is literally just a library of Haskell modules that the compiler knows about. The ghc-pkg tool is your girl for adding them to a package database or yeeting them out of one. By default? It messes with the system-wide package database. But if you want, you can also act on the user's local package database, or a whole other file you specify. Your call, main character.
To make a package available for ghc, you use ghc-pkg to register it. Unregistering it removes it from the database. And here's the tea: packages can also be hidden, which makes ghc ignore the package by default without uninstalling it. Then exposing a package makes a hidden package available again. On top of all that, ghc-pkg has a bunch of commands to query the package database. Versatile queen π
.
Now, when a package name is required, you can name the package in full β version number and all (e.g. network-1.0) β or without the version number. Naming a package without the version number matches all versions of the package, and the specified action gets applied to all the matching packages. And if you want to be super clear that you're matching multiple packages, you can write a package specifier as pkg-*. Periodt.
π ACTIONS π
register filename|-β Register the package using the specified installed package description.update filename|-β Register the package, overwriting any other package with the same name.unregister pkg-idβ Unregister the specified package.expose pkg-idβ Expose the specified package.hide pkg-idβ Hide the specified packagelist [pkg]...β List registered packages in the global database, and also the user database if--useris given. If a package name is given, all the registered versions will be listed in ascending order. Accepts the--simple-outputflag.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:
dot tred dot -Tpdf >pkgs.pdf
find-module moduleβ List registered packages exposing modulemodulein the global database, and also the user database if--useris given. All the registered versions will be listed in ascending order. Accepts the--simple-outputflag.latest pkg-idβ Prints the highest registered version of a package.checkβ Check the consistency of package dependencies and list broken packages. Accepts the--simple-outputflag.describe pkgβ Give the registered description for the specified package. The description is returned in precisely the syntax required byghc-pkg register.field pkg fieldβ Extract the specified field of the package description for the specified package. Accepts comma-separated multiple fields.dumpβ Dump the registered description for every package. This is likeghc-pkg describe '*', expect that it is intended to be used by tools that parse the results, rather than humans.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--useror--package-confas appropriate.
πΈ OPTIONS πΈ
π When asked to modify a database
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-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. That's the rule, bestie.
Commands that query the package database (list, latest, describe, field) operate on the list of databases specified by the flags --user, --global, and --package-conf. If none of these flags are given, the default is --global --user.
--userβ Use the current user's package database.--globalβ Use the global package database.-f FILE,--package-conf=FILEβ Use the specified package config file.--global-conf=FILEβ Location of the global package config.--forceβ Ignore missing dependencies, directories, and libraries.--force-filesβ Ignore missing directories and libraries only.-g,--auto-ghc-libsβ Automatically build libs for GHCi (withregister).-?,--helpβ Display a help message and exit.-V,--versionβ Output version information and exit.--simple-outputβ Print output in easy-to-parse format for some commands.--names-onlyβ Only print package names, not versions; can only be used withlist --simple-output.--ignore-caseβ Ignore case for substring matching.
π ENVIRONMENT VARIABLES π
GHC_PACKAGE_PATHβ TheGHC_PACKAGE_PATHenvironment variable may be set to a:-separated list of files containing package databases. This list of package databases is used byghcandghc-pkg, with earlier databases in the list overriding later ones. This order was chosen to match the behaviour of thePATHenvironment variable; think of it as a list of package databases that are searched left-to-right for packages.
If GHC_PACKAGE_PATH 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:
export GHC_PACKAGE_PATH=$HOME/.my-ghc-packages.conf:
To check whether your GHC_PACKAGE_PATH setting is doing the right thing, ghc-pkg list will list all the databases in use, in the reverse order they are searched. Vibe check your env vars, fr fr.
π FILES π
Both of these locations are changed for Debian. Upstream still keeps these under /usr. Some programs may refer to that, but look in /var instead. Noted. π
/var/lib/ghc/package.confβ Globalpackage.conffile./var/lib/ghc/package.conf.d/β Directory for library specificpackage.conffiles. These are added to the global registry.
π SEE ALSO π
π«Ά AUTHOR π«Ά
This manual page was written by Kari Pahula <kaol@debian.org>, for the Debian project (and may be used by others).
and that's the whole page, bestie π this one's from 2010-01-27, part of the ghc-pkg(1) manual β go forth and manage those packages, you absolute icon πβ¨
π¦ where this page comes from
- debian bookworm: ghc 9.0.2-4 Β· BSD-3-Clause
- epel 10: ghc-compiler 9.6.6-146.el10_0 Β· BSD-3-Clause
- epel 10: ghc8.10-compiler 8.10.7-17.el10_0 Β· BSD-3-Clause
- epel 10: ghc9.0-compiler 9.0.2-20.el10_0 Β· BSD-3-Clause
- epel 10: ghc9.10-compiler 9.10.3-11.el10_2 Β· BSD-3-Clause
- epel 10: ghc9.2-compiler 9.2.8-28.el10_0 Β· BSD-3-Clause
- epel 10: ghc9.4-compiler 9.4.8-34.el10_0 Β· BSD-3-Clause
- epel 10: ghc9.6-compiler 9.6.7-24.el10_0 Β· BSD-3-Clause
- epel 10: ghc9.8-compiler 9.8.4-14.el10_0 Β· BSD-3-Clause
- epel 9: ghc-compiler 8.10.7-116.el9 Β· BSD
- epel 9: ghc9.0-compiler 9.0.2-7.el9 Β· BSD
- epel 9: ghc9.2-compiler 9.2.8-18.el9 Β· BSD-3-Clause
- epel 9: ghc9.4-compiler 9.4.8-25.el9 Β· BSD-3-Clause
- epel 9: ghc9.6-compiler 9.6.7-25.el9 Β· BSD-3-Clause
- epel 9: ghc9.8-compiler 9.8.4-12.el9 Β· BSD-3-Clause
- fedora 43: ghc-compiler 9.8.4-149.fc43 Β· BSD-3-Clause
- fedora 43: ghc8.10-compiler 8.10.7-15.fc41 Β· BSD-3-Clause
- fedora 43: ghc8.10-compiler 8.10.7-19.fc43 Β· BSD-3-Clause
- fedora 43: ghc9.0-compiler 9.0.2-18.fc41 Β· BSD-3-Clause
- fedora 43: ghc9.0-compiler 9.0.2-22.fc43 Β· BSD-3-Clause
- fedora 43: ghc9.10-compiler 9.10.3-11.fc43 Β· BSD-3-Clause
- fedora 43: ghc9.12-compiler 9.12.2-8.fc43 Β· BSD-3-Clause
- fedora 43: ghc9.2-compiler 9.2.8-30.fc43 Β· BSD-3-Clause
- fedora 43: ghc9.4-compiler 9.4.8-36.fc43 Β· BSD-3-Clause
- fedora 43: ghc9.6-compiler 9.6.7-25.fc43 Β· BSD-3-Clause
- fedora 43: ghc9.8-compiler 9.8.4-16.fc43 Β· BSD-3-Clause
- fedora 44: ghc-compiler 9.10.3-155.fc44 Β· BSD-3-Clause
- fedora 44: ghc8.10-compiler 8.10.7-15.fc41 Β· BSD-3-Clause
- fedora 44: ghc9.0-compiler 9.0.2-18.fc41 Β· BSD-3-Clause
- fedora 44: ghc9.10-compiler 9.10.3-12.fc44 Β· BSD-3-Clause
- fedora 44: ghc9.10-compiler 9.10.3-14.fc44 Β· BSD-3-Clause
- fedora 44: ghc9.2-compiler 9.2.8-31.fc44 Β· BSD-3-Clause
- fedora 44: ghc9.4-compiler 9.4.8-37.fc44 Β· BSD-3-Clause
- fedora 44: ghc9.6-compiler 9.6.7-26.fc44 Β· BSD-3-Clause
- fedora 44: ghc9.8-compiler 9.8.4-16.fc43 Β· BSD-3-Clause
- opensuse-leap 16.0: ghc-compiler 9.8.3-bp160.1.34 Β· BSD-3-Clause
- opensuse-leap 16.0: ghc-compiler 9.8.3-bp160.1.34 Β· BSD-3-Clause
- opensuse-leap 16.0: ghc-compiler 9.8.3-bp160.1.34 Β· BSD-3-Clause
- ubuntu jammy: ghc 8.8.4-3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms