In macOS, if I execute
cabal install foo --global
where does cabal
install the foo package?
There is no one place GHC stores global data—it depends on the configuration and that will vary by where you got GHC from (nixpkgs, Homebrew (brew
), MacPorts, raw from GHCHQ, etc.). For your particular case, you can get information as described by DanielWagner:
ghc-pkg describe unix --global
And some simple shell scripting can extract the specific information you desire:
ghc-pkg describe unix --global | egrep '^pkgroot' | cut -d' ' -f2
Output:
"/usr/local/Cellar/ghc/8.4.1/lib/ghc-8.4.1"
Or:
% nix-shell -p ghc
ghc-pkg describe unix --global | egrep '^pkgroot' | cut -d' ' -f2
Output:
"/nix/store/z0ypzmbhn6m0l2adzm8szcd72z7kwy04-ghc-8.0.2/lib/ghc-8.0.2"