1
votes

cabal install ghc-mod seems to work, but when I try cabal run ghc-mod I get the following error:

Package has never been configured. Configuring with default flags. If this fails, please configure manually.
cabal: No cabal file found.
Please create a package description file <pkgname>.cabal

The resources I've found seem to suggest that creating a package description file shouldn't be necessary to install a package.

Any ideas?

1
cabal run is for running executables in a cabal environment. This is not your use case. You just want to run an executable which is created by a cabal package, namely ghc-mod. By default, cabal places executables in the cabal directory (on windows this is %APPDATA%/cabal - hopefully you can figure out which directory it is on your machine).user2407038
Thanks. My executables seem to have been placed in $HOME/Library/Haskell/bin, which I added to my PATH, but I can't run ghc-mod.hjkml
Never mind, there was a typo in my PATH. Thanks for your help.hjkml

1 Answers

-2
votes

The standard way to install stuff on Haskell nowadays is within sandboxes.

Go to the terminal and create an empty folder that will house your ghc-mod sandbox. cd into that folder and:

cabal sandbox init
cabal install ghc-mod

After it finishes you will find the ghc-mod binary you seek within .cabal-sandbox/bin. Since it's statically linked it's safe to move it to somewhere in your $PATH.

I strongly encourage you use a sandbox but if you don't want to go to .cabal in your home directory and you will find the binary with bin