4

I’ve just installed the Haskell Platform on my Mac running Mavericks 10.9. The cabal version included (1.16) is out of date, and prompts me to run “cabal update” and then “cabal install cabal-install". Doing so installs cabal 1.20.0.3, but it installs in ~/Library/Haskell. This is not in my executable path, so further attempts to run cabal result in executing version 1.16 from /usr/bin, which was not updated.

I guess I could get around this by changing my executable path to include ~/Library/Haskell, with higher preference than /usr/bin. But I don’t really want to do this. And I don’t want to maintain multiple out of date versions of the software in hidden locations on my system. How do I get cabal to update the executable in the right place? Running with sudo did not help.

Edit: Updated my path, but somehow it still doesn’t work:

[76 of 76] Compiling Main             ( Main.hs, dist/build/cabal/cabal-tmp/Main.o )
Linking dist/build/cabal/cabal ...
Warning: No documentation was generated as this package does not contain a library. Perhaps you want to use the --executables flag.
Installing executable(s) in
/Users/lethe/Library/Haskell/ghc-7.6.3/lib/cabal-install-1.20.0.3/bin
Installed cabal-install-1.20.0.3
Updating documentation index /Users/lethe/Library/Haskell/doc/index.html
euclid:Public lethe$ which cabal
/Users/lethe/Library/Haskell/bin/cabal
euclid:Public lethe$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library 
euclid:Public lethe$ echo $PATH
/Users/lethe/Library/Haskell/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin

It claims it installed cabal 1.20.0.3 to ~/Library/Haskell, and since the path is updated, it claims it’s going to execute the version in ~/Library/Haskell, but it also claims the executed version is 1.16.0.2. What’s going on here?

I also tried ghc-pkg recache and cabal install cabal-install-1.20.0.3 (with version number specified), but executed version is still 1.16.0.2

ziggurism
  • 2,264
  • 2
  • 16
  • 23
  • same problem...any updates? – Coffee_Table Aug 04 '14 at 02:31
  • @Coffee_Table: No updates. I gave up. – ziggurism Aug 06 '14 at 02:07
  • @Coffee_Table: I'm sure this is way too late to help you, but apparently I also posted about this issue on GitHub (and immediately forgot that I did). https://github.com/haskell/cabal/issues/2003. The dev posted an answer that I assume is correct. Since I'm no longer dealing with this I don't test it. – ziggurism Nov 03 '15 at 00:50

3 Answers3

1

There are a couple of solutions:

1) Try updating the PATH variable such that it looks in your local path first. (Add this to your .bash_profile: export PATH=$HOME/Library/Haskell/bin:$PATH. Source the profile and then retry the whereis command to identify which binary you are using, it should use your local one)

Though this didn't work for me. I had to resort to the next step to make it work:

2) Brute force fix: Delete /usr/bin/cabal.

Hope this helps.

GeneralBecos
  • 2,476
  • 2
  • 22
  • 32
1

According to 23skiddo at GitHub, the way to get cabal to install in the system-wide directory is cabal install --global. Also if your shell is executing the wrong path to an executable you probably need to clear the cache with hash -d cabal or hash -r.

Community
  • 1
  • 1
ziggurism
  • 2,264
  • 2
  • 16
  • 23
0

I once had an alias to a command and forgot about it. That is not picked up by "which ".

Try $(which cabal) --version. If it shows 1.20 there may be some similar problem. Use compgen -a to list your aliases.

/Users/lethe/Library/Haskell/ghc-7.6.3/lib/cabal-install-1.20.0.3/bin also is not /Users/lethe/Library/Haskell/bin.

Also:

There is a new Haskell-Plattform release 2014.2 now. This comes with Cabal 1.18 and GHC 7.8.3.

It updates easily to Cabal 1.20 (I don't know why it does not come with 1.20 in the first place).

I already tried many different setups between using Haskell-Plattform, Homebrew ghc + haskell-plattform and also http://ghcformacosx.github.io/

Last one makes most sense to me after trying all different ways to use Haskell on OSX.

If you switch between different "distributions" make sure you really get rid of "everything" that is installed from other versions of Haskell.

I think the most important thing is to recognize that all of those installations are more or less the same. It just moves paths and preferences around.

OderWat
  • 5,379
  • 3
  • 29
  • 31