How do you set the executable output location for a Haskell project built with Stack?

You can use the --copy-bins flag (or the install command) to copy the executables to some output directory. That destination directory can be controlled with --local-bin-path, but defaults to ~/.local/bin on POSIX systems.


stack path --local-install-root outputs path to build artifact. You just need to add /bin/name-of-my-exe to this path to get path of executable. And then you just run simple one-line bash script to copy executable to desired location.

Full command for completeness:

cp "$(stack path --local-install-root)/bin/name-of-my-exe" ~/.local/bin/name-of-my-exe