Search code examples
haskellcabalcabal-install

Cabal claims it has updated itself but has not really


Following the instructions from this post on how to update cabal-install, I seemed to be able to install the latest version (or at least some version > 1.18, which is what I wanted.

$ cabal install Cabal cabal-install
Resolving dependencies...
Configuring cabal-install-1.22.6.0...
Building cabal-install-1.22.6.0...
Preprocessing executable 'cabal' for cabal-install-1.22.6.0...
<snip>
Linking dist/build/cabal/cabal ...
Installing executable(s) in /home/kavi/.cabal/bin
Installed cabal-install-1.22.6.0

However, when I tried cabal sandbox, it failed, so I checked cabal --version.

$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library 

As you can see, the version is not the one that cabal claimed to install.

Adding ~/.cabal/bin to my path did nothing to help. (Yes, I did restart my terminal).

$ echo $PATH
<snip>:/home/kavi/.cabal/bin
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library 

I tried restarting my computer, but still:

$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library

I am using Ubuntu 14.04.


Solution

  • You should add /home/kavi/.cabal/bin to the beginning of the $PATH.

    which cabal tells which executable shell will pick to execute, on my machine:

    % echo $PATH
    /Users/ogre/.local/bin:...
    
    % which cabal
    /Users/ogre/.local/bin/cabal