2

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
GladstoneKeep
  • 3,832
  • 2
  • 26
  • 38

1 Answers1

10

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.

Daniel Wagner
  • 145,880
  • 9
  • 220
  • 380
  • 3
    Thank you! In case useful for OS X users, it seems I _had_ already run `cabal install cabal-install` but without realizing that the upgrade got installed into `~/.cabal/bin/cabal`, different from Homebrew's original installation location `/usr/local/bin/cabal`. Doing `export PATH=$HOME/.cabal/bin:$PATH` cleared that issue. – GladstoneKeep May 27 '14 at 20:59
  • After running "cabal install cabal-install" and successfully installing "cabal-install-1.20.0.2", I still have "cabal-install version 1.16.0.2 using version 1.16.0 of the Cabal library". Why? – Incerteza Jun 22 '14 at 07:59
  • 2
    @AlexanderSupertramp Perhaps you do not have `$HOME/.cabal/bin` in your `$PATH`; or perhaps your shell requires a `rehash`. – Daniel Wagner Jun 22 '14 at 14:01