haskellcabalcabal-dev

'cabal run' gives "unrecognised command: run"


I'm attempting to create simple Cabal executable package.

The Cabal user guide's "Running executables" section says:

You can have Cabal build and run your executables by using the run command.

cabal run EXECUTABLE [-- EXECUTABLE_FLAGS]

Yet when I enter that command:

$ cabal run HelloWorld

I get this error message:

cabal: unrecognised command: run (try --help)

cabal --help tells me that, indeed, there is no run command.

Am I missing something? How do I run my executable?


I'm totally new to Haskell and Cabal; please let me know what info would be helpful to include here.

I'm on Mac OS X 10.8.5.

cabal --version gives:

cabal-install version 0.14.0
using version 1.14.0 of the Cabal library 

ghc --version gives:

The Glorious Glasgow Haskell Compilation System, version 7.4.2

Solution

  • Your version of cabal-install is too old. The newest version of cabal-install is 1.20. You can upgrade to this version by running cabal install cabal-install.