Difference between revisions of "Mac OS X"

From HaskellWiki
Jump to navigation Jump to search
(updated link to eclipsefp)
Line 76: Line 76:
   
 
* [http://aquamacs.org/ AquaMacs], a graphical Emacs version
 
* [http://aquamacs.org/ AquaMacs], a graphical Emacs version
* [http://eclipsefp.sourceforge.net/Eclipse] with the [http://eclipsefp.github.com/ EclipseFP] plugin
+
* [http://eclipsefp.sourceforge.net/ Eclipse] with the [http://eclipsefp.github.com/ EclipseFP] plugin
 
* [http://www.gnu.org/software/emacs/ Emacs], is installed on every Mac
 
* [http://www.gnu.org/software/emacs/ Emacs], is installed on every Mac
 
* [http://leksah.org/ Leksah]
 
* [http://leksah.org/ Leksah]

Revision as of 21:19, 11 February 2012

There is also now the Mac OS X Strike Force that aims to improve using Haskell on OS X.

The Haskell Platform

There are Mac OS X installers of the full Haskell Platform development environment. We recommend it:

button-100.png

GHC

Important notes

To get the most out of your GHC environment, you should add '~/.cabal/bin' to your PATH environment variable before the path where you have GHC installed. This will allow you to get and use cabal-updates, as well as other programs shipped with GHC like hsc2hs.

In your ~/.profile, add the line:

export PATH="~/.cabal/bin:$PATH";


Mac OS X 10.5 (Leopard)

To install GHC on Mac OS X 10.5 (Leopard), there are the following options:

Mac OS X 10.6 (Snow Leopard) and 10.7 (Lion)

To uninstall ghc call: sudo /Library/Frameworks/GHC.framework/Tools/Uninstaller

Xcode 4.1

GHC needs Xcode to be installed so it has access to the bintools, headers, and link libraries of the platform. The later two are provided by the SDK that comes as part of Xcode. GHC 7.0.2 is compiled against the 10.5 SDK. Xcode 4.1 no longer ships with it. ghci will work, but linking and some compiles with <ghc> will not. To make those work you need a copy of the 10.5 SDK. You can get this one several ways:

  • Before you install Xcode 4.1, if you have Xcode 3.2 installed, do one of the following:
    • Move it aside (renaming /Developer to /Xcode3.2)
    • Move just the sdk aside (moving /Developer/SDKs/MacOSX10.5.sdk to, say, /ExtraSDKs/MacOSX10.5.sdk)
    • Move just the sdk aside, install Xcode 4.1, then move it back into the /Developer/SDKs directory.
  • If you don't have Xcode 3.2, then you can download it from the Apple Developer site, and install it in a location other than "/Developer". If you have already installed Xcode 4.1 be sure that you customized the install and don't install the "System Tools" or "UNIX Development" packages.

Building via GHC:

ghc --make -I{loc}/MacOSX10.5.sdk/usr/include/ -L{loc}/MacOSX10.5.sdk/usr/lib

Building via cabal:

cabal --extra-include-dirs={loc}/MacOSX10.5.sdk/usr/include/ --extra-lib-dirs={loc}/MacOSX10.5.sdk/usr/lib

Replace {loc} with wherever you put the SDK.

HUGS


Installing libraries with external C bindings

Haskell libraries are installed with the cabal command line tool.

Some libraries depend on external C libraries, which are best installed with MacPorts. However, you have to tell cabal to include the /opt/local/ directories when searching for external libraries. The following shell script does that by wrapping the cabal utility

   > cat cabal-macports
   #!/bin/bash
   export CPPFLAGS=-I/opt/local/include
   export LDFLAGS=-L/opt/local/lib
   cabal $@ --extra-include-dirs=/opt/local/include \
            --extra-lib-dirs=/opt/local/lib
   > cabal-macports install foobar

Editors with Haskell support

Open Source

  • AquaMacs, a graphical Emacs version
  • Eclipse with the EclipseFP plugin
  • Emacs, is installed on every Mac
  • Leksah
  • MacVim, a graphical Vim version
  • Vim, is installed on every Mac
  • Yi (written in Haskell itself!), is available through cabal-install

Commercial

SubEthaEdit:

SubEthaEdit.png

TextMate:

TextMate.png

and Smultron:

Smultron.png

TextEdit is Mac's default text editor, a very basic editor that works fine for most uses, you must however be careful to put it into plain text mode using the Format menu.

Shipping Installable Haskell Applications

  • mkbndl builds installable Mac OSX applications from your Haskell project.

Links