0

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
ezyman
  • 155
  • 8

1 Answers1

1

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.

Vikstapolis
  • 744
  • 3
  • 13
  • note that the official script from https://www.haskell.org/ghcup/ already modifies your path variable, so the steps in this answer most likely are not actually necessary. What is much more likely is that you need to close your terminal / powershell application, then re-open it in order for the PATH settings that were changed by the installer to update. [See my answer in another question](https://stackoverflow.com/a/73184330/2990344) – xdavidliu Jul 31 '22 at 14:58