September 23, 2026

The mac mini -- Haskell

The first step in installing Haskell is to be sure that the command line tools from Apple are installed:
xcode-select --install
Apparently you can install all of Xcode, which is a big (12G) IDE to do code development for iOS as well as macOS. The above just installs the command line tools.

And it tells me that they are already installed. Apparently when I tried to run "cc" and then it asked if I wanted to install the compiler, it did this for me. Next I do this:

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
It will install to /Users/tom/.ghcup. It can install these components:
ghcup
ghc
cabal
stack
hls
I select the G channel and say no to alpha releases.
I tell it to tweak my .bashrc PATH.
I say yes to hls (their IDE)
It looks like I am getting cabal and the whole shebang as indicated above.
It concludes the install with:
o start a simple repl, run:
  ghci

To start a new haskell project in the current directory, run:
  cabal init --interactive

To install other GHC versions and tools, run:
  ghcup tui

If you are new to Haskell, check out https://www.haskell.org/ghcup/steps/
I did all this over an ssh connection. I log out and back in so I get a new shell and pick up the changes to .bashrc.

Check it out

I type "ghci" and that works.

I type "which runghc" and discover that this is in /Users/tom/.ghcup/bin/runghc Putting this in the "shebang" line for xyz.hs does not work. Apparently macOS won't process nested shebangs and runghc itself is a bash script. Using "env" on the first line will fix this.
This "script" works:

#!/usr/bin/env runghc
#!/usr/bin/runghc

main = putStrLn "hey"
Actually, it would work on linux also, so I could start using this for my shebang line there to make scripts portable.

Typing "ghc" gives me:

ghc-9.10.3: no input files
So this all looks good.
Have any comments? Questions? Drop me a line!