Requiring sudo to run ghci on OSx

450 views Asked by At

I've installed the Haskell platform on my OSX (Yosemite).

When I try to execute the ghci, the following error occurs:

GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help

Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... <command line>: can't load .so/.DLL for: libiconv.dylib (dlopen(libiconv.dylib, 9): image not found)

If I execute using sudo (sudo ghci), it runs normally. The same behavior occurs with cabal.

I've tried to install using the default installer, using homebrew and using the script provided by Yann Esposito (http://yannesposito.com/Scratch/en/blog/Safer-Haskell-Install/), without changes in this behavior. Am I missing something?

1

There are 1 answers

1
damorais On BEST ANSWER

Finally, I've discovered the answer:

The problem is with my DYLD_FALLBACK_LIBRARY_PATH. The value was defined to the directory of my POSTGRESQL bin folder. So, I've appended the recommended values pointed by the man page of dyld (man dyld), reloaded my .bash_profile and now my ghci, cabal and ghc are working smoothly.

The recommended value is: "$HOME/lib:/usr/local/lib:/lib:/usr/lib"