Skip to content

Unable to start HIE Server on Mac OS X, get "ghc command not found" #126

Closed
@ianbrault

Description

@ianbrault

I get the following issue when attempting to open a Haskell project folder in VS Code on Mac OS X 10.14:

2018-12-12 10:24:12.024134 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Info  - 10:24:12 AM] Connection to server got closed. Server will restart.
2018-12-12 10:24:12.066354 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Info  - 10:24:12 AM] Connection to server got closed. Server will restart.
2018-12-12 10:24:12.100128 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Info  - 10:24:12 AM] Connection to server got closed. Server will restart.
2018-12-12 10:24:12.135374 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Info  - 10:24:12 AM] Connection to server got closed. Server will restart.
2018-12-12 10:24:12.169213 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Error - 10:24:12 AM] Connection to server got closed. Server will not be restarted.

The project was created using stack new and can build successfully with stack build.

I do not get a similar issue when I run hie in the workspace (hie is on my $PATH):

2018-12-12 10:26:00.863747 [ThreadId 4] - Using stack GHC version
2018-12-12 10:26:01.439648 [ThreadId 4] - Run entered for HIE(hie) Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2
2018-12-12 10:26:01.447437 [ThreadId 4] - Current directory:/Users/ianbrault/code/haskell/io

nor attempting to run with hie-wrapper (also on my $PATH):

2018-12-12 10:26:59.152784 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2
2018-12-12 10:26:59.164961 [ThreadId 4] - Current directory:/Users/ianbrault/code/haskell/io
2018-12-12 10:27:00.31076 [ThreadId 4] - Cradle directory:/Users/ianbrault/code/haskell/io
2018-12-12 10:27:00.311226 [ThreadId 4] - Using stack GHC version
2018-12-12 10:27:00.488775 [ThreadId 4] - Project GHC version:8.6.2
2018-12-12 10:27:00.489596 [ThreadId 4] - hie exe candidates :["hie-8.6.2","hie-8.6","hie"]
2018-12-12 10:27:00.490847 [ThreadId 4] - found hie exe at:/usr/local/bin/hie-8.6.2
2018-12-12 10:27:00.491539 [ThreadId 4] - args:[]
2018-12-12 10:27:00.491991 [ThreadId 4] - launching ....



2018-12-12 10:27:00.751399 [ThreadId 4] - Using stack GHC version
2018-12-12 10:27:00.949176 [ThreadId 4] - Run entered for HIE(hie-8.6.2) Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2
2018-12-12 10:27:00.96506 [ThreadId 4] - Current directory:/Users/ianbrault/code/haskell/io

Versions of all tools:

  • ghc: The Glorious Glasgow Haskell Compilation System, version 8.6.2
  • stack: Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1
  • hie: Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2
  • hie-wrapper: Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2
  • note: the HIE scripts were downloaded from the pre-built Mac binaries provided by the latest release

This is my $PATH: /Users/ianbrault/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/ianbrault/.local/bin:/usr/local/texlive/2017/bin/x86_64-darwin:/Library/TeX/texbin, all of the above binaries are installed in /usr/local/bin

I have seen several other issues where the users get a similar /bin/sh: ghc: command not found error message but I have attempted all the suggested fixes in those issues and have not been able to resolve the problem, specifically:

  • setting languageServerHaskell.hieExecutablePath to point directly at the hie binary
  • setting languageServerHaskell.useCustomHieWrapper to true and setting languageServerHaskell.useCustomHieWrapperPath to point directly at the hie-wrapper binary
  • symlinking hie-wrapper to be the hie binary
  • running stack update and stack upgrade
  • I have also tried setting the resolver to specifically target ghc-8.6.2 but still get the same errors

Please let me know if there's any more information that would be useful! Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions