How to run ghc 8.10.7 installed via GHCup on Windows 10?

1.6k Views Asked by At

I have just installed GHC 8.10.7 via GHCup on my Windows 10. I have an earlier release already installed (ghc 9.2.1). After installing ghc 8.10.7 I got the following info:

In order to run ghc and cabal, you need to adjust your PATH variable.
To do so, you may want to run 'source /c/ghcup/env' in your current terminal
session as well as your shell configuration (e.g. ~/.bashrc).

How to understand this information, since when I run source /c/ghcup/env in the terminal I get this:

PS C:\Users\ephra> source /c/ghcup/env
source: The term 'source' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS C:\Users\ephra>

And it seems that ghc 8.10.7 is not visible:

PS C:\Users\ephra> ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.1
PS C:\Users\ephra>

GHC 8.10.7 folder:

C:\ghcup\ghc\8.10.7
1

There are 1 best solutions below

1
On

To do so, you may want to run 'source /c/ghcup/env' in your current terminal session as well as your shell configuration (e.g. ~/.bashrc).

This works in a Linux terminal, but going by your prompt you're using PowerShell on Windows. To use the ghc command, you'll need to update your Path environment variable. This answer already covers how to modify your Path so I'm not going to write that again here - just follow the steps there to add C:\ghcup\bin to your path and you should be fine.

NOTE: Look at this comment below the linked answer to save yourself some time.