This is probably a very dumb question, but I can't seem to find the answer...
Asked
Active
Viewed 2.1k times
44
-
16Have you tried `ghc --version` in the command line? – Karolis Juodelė Oct 25 '12 at 17:14
-
You might have multiple! A hacky but very easy way to check which ones is to type `ghc-` into your terminal, then hit tab to ask your shell for completions. – Daniel Wagner Jun 02 '21 at 07:07
3 Answers
45
To find which version my stack
is using, I ran
$ stack ghc -- --version
and got
$ stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2

mherzl
- 5,624
- 6
- 34
- 75
-
2Nice use of the double hyphen! Can be used with the sandboxed version of ghc as well! – bergercookie Aug 29 '17 at 10:45
-
5Warning: if you do not have `ghc` installed, this command will download almost 200MB and install `ghc` in your system. – evaristegd Jul 26 '20 at 19:46
-
@evaristegd Just happened to me: `Preparing to install GHC to an isolated location.` – Daniel Nov 18 '21 at 16:35
32
ghc --version
did the trick on Ubuntu, thanks Karolis!
Edit: works on mac too (macOS Sierra 10.12.6)

Nick Brady
- 6,084
- 1
- 46
- 71

Diego Saa
- 1,426
- 1
- 13
- 23
6
Depending on your install method and architecture, some commands may differ. Some people may have several versions installed. Here is a selection of information that may be useful:
stack version
❯ stack --version
Version 2.1.3, Git revision 0fa51b9925decd937e4a993ad90cb686f88fa282 (7739 commits) x86_64 hpack-0.31.2
ghc version (as noted by @mherzl)
❯ stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
standard ghc version command
❯ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.1
cabal version
❯ cabal --version
cabal-install version 3.0.0.0
compiled using version 3.0.0.0 of the Cabal library
GHC's repl
❯ ghci --version
The Glorious Glasgow Haskell Compilation System, version 8.8.1
If using llvm with -fllvm
flag
❯ llvm-gcc -v
Apple clang version 11.0.0 (clang-1100.0.33.16)
Target: x86_64-apple-darwin19.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Michael Treanor
- 585
- 8
- 9