Skip to main content
1 of 5
Galder Zamarreño
  • 1.6k
  • 2
  • 12
  • 21

Emacs and command line $PATH disagreements causing issues with Haskell Cabal

Having some issues with PATH settings on Emacs that are affecting my Haskell environment:

I'm using ZSH, and when I go to the command line and call echo $PATH, it returns: /Users/g/Library/Haskell/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

This is coming from .zprofile configuration where I have:

# Set the list of directories that Zsh searches for programs.
path=(
  ~/Library/Haskell/bin
  /usr/local/{bin,sbin}
  $path
)

So, from command line, when I call which cabal, I correctly get: /Users/g/Library/Haskell/bin/cabal

When I start Emacs and go to the shell and call which cabal, I get: /usr/bin/cabal which is causing me issue since it's a different version.

When I inspect echo $PATH from the Emacs shell, I see: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/g/Library/Haskell/bin:/usr/local/sbin

I've no idea how on earth the PATH can be different...

Anyone knows how to get my ZSH shell and Emacs to agree on the same PATH? I suspect that's what's controlling where cabal is being loaded from

Galder Zamarreño
  • 1.6k
  • 2
  • 12
  • 21