Sunday, February 24, 2013

building F# compiler on Mac OS X 10.8 Mountain Lion

F# is a lovely mixed paradigm functional language targeting the Common Language Runtime, which works great cross-platform on Mono.

I had some trouble getting it installed on my machine, so this documents the exact steps I followed at the end of February, 2013, to get everything up and running. Initially I was following F# 3.0 in the Mac and Mono World. Dave's blog has a bunch of other great content which I recommend you check out.


- Download and run the installer for mono 3.x: http://www.go-mono.com/mono-downloads/download.html

In the console:


# Check installed mono version:
$ mono -V

# I get 3.0.4.

# add mono to pkgconfig path
# in your .bash_profile:
export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/Current/Lib/pkgconfig/


# Git clone fsharpc:
$ git clone git://github.com/fsharp/fsharp.git

# Make sure brew packages are installed and up to date:

$ brew update
$ brew install pkg-config
$ brew install autoconf

# cd to fsharpc directory and comment out mono version check in ./configure:

$ cd ~/dev/fsharpc

# For me, lines 1764 - 1766

# #if ! pkg-config --atleast-version=$MONO_REQUIRED_VERSION mono; then
# # as_fn_error $? "\"You need mono $MONO_REQUIRED_VERSION\"" "$LINENO" 5
# #fi

# Run config script with correct paths:

$ ./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current/ --with-gacdir=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/gac

$ make

$ sudo make install

# verify the install:
$ fsharpc
F# Compiler for F# 3.0 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License

error FS0207: No inputs specified


Now you're ready to go.

No comments:

Post a Comment