Created
February 2, 2015 09:19
-
-
Save hesselink/885dd7d736578b9cde50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "After installing a new version of GHC the system wide executable symbolic" | |
echo "links will be pointed directly to the installed version instead of the" | |
echo "very useful 'Current' link in /Library/Frameworks/GHC.framework/Versions." | |
echo "This is a problem because the 'switch-ghc' script will no longer work." | |
echo | |
echo "To fix this this script deletes the GHC related symlinks in both /usr/bin" | |
echo "(default installs) and /usr/local/bin (snapshot installs)." | |
echo | |
echo "After deleting the direct symlinks we create a new set of links pointing" | |
echo "to the 'Current' version. From now on we can safely manage the current GHC" | |
echo "version with the 'switch-ghc' script." | |
echo | |
echo "The tools involved are: ghc, ghci, ghc-pkg, haddock, runghc and runhaskell. " | |
echo | |
echo "Press ENTER to continue, CTRL-C to abort." | |
echo | |
read | |
for i in ghc ghci ghc-pkg haddock runhaskell runghc hsc2hs | |
do | |
find /usr/bin/$i -type l -exec rm {} \; | |
find /usr/local/bin/$i -type l -exec rm {} \; | |
ln -s /Library/Frameworks/GHC.framework/Versions/Current/usr/bin/$i /usr/bin/$i | |
done | |
exit | |
echo Done. | |
echo You should now probably run switch-ghc and pick your favorite compiler! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VERSION=$1 | |
pushd /Library/Frameworks/GHC.Framework/Versions/ > /dev/null | |
if [ "${VERSION}" = "" ] | |
then | |
echo Please specify version of GHC to switch to. | |
ls | grep -v Current | |
exit | |
fi | |
rm Current | |
ln -s $(ls | grep "^${VERSION}") Current | |
echo -n "Current:" | |
ls -l Current | cut -d ">" -f 2 | |
popd > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment