cmal
cmal

Reputation: 2222

How to prevent stack from downloading GHC for every new project?

How to prevent stack from downloading GHC for every new project?

Every time I create a new project using stack and then build or exec the codes, stack will install a new GHC for me. This is not only boring for waiting such a long time for a huge image to be downloaded (behind the GFW, xKib/s), but also a space disaster for my pity 128G SSD Macbook Pro. How can I fix this?

$ stack exec blah
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
ghc-8.4.4:   15.98 KiB / 220.05 MiB (  0.01%) downloaded...^C

Upvotes: 12

Views: 2728

Answers (2)

Dan Burton
Dan Burton

Reputation: 53675

Stack only installs a new ghc if the stack.yaml you are using requires some ghc version that you do not yet have installed via stack. Once stack has installed ghc-8.4.4, for example, it will not reinstall this version of ghc.

I would presume the solution, then, is to make sure you are using the same resolver for all of your projects, so that stack only installs the one ghc version.

Upvotes: 11

cmal
cmal

Reputation: 2222

Just find $HOME/.stack.yaml and add:

# Turn on system GHC
system-ghc: true

and run the same command again.

Upvotes: 5

Related Questions