Since Mono 3.0.2, Our Mac can run F# 3.0. Please check F# 3.0 on Mac
F# is an object-oriented functional language by Microsoft. It's based on C#. I try to explain what technologies of Java-lang are corresponding to:
execution environment | object-oriented language | object-oriented functional language | |
---|---|---|---|
Java technologies | JVM | Java | Scala |
.NET technologies | CLR | C# | F# |
And F# is also available on Mono, not only .NET . Let's install F# on Mac OS X from scratch!
- Download Mono 2.8 from here
- Install Mono 2.8
- Download mono.snk from here
- Download F# zip from here
- Unpack fsharp.zip
- cd /Library/Frameworks/Mono.framework/Versions/2.8/lib
- move unpacked directory (e.g. FSharp-2.0.0.0) to ./fsharp
- cd fsharp, and copy mono.snk to here
- sudo chown -R root:admin ../fsharp
- sudo ./install-mono.sh
At last, we had better aliasing two F# commands like below:
alias fsc='mono /Library/Frameworks/Mono.framework/Versions/2.8/lib/fsharp/bin/fsc.exe'
alias fsi='mono /Library/Frameworks/Mono.framework/Versions/2.8/lib/fsharp/bin/fsi.exe'
That's OK. Start the interactive shell:
$ fsi Microsoft (R) F# 2.0 Interactive build 2.0.0.0 Copyright (c) Microsoft Corporation. All Rights Reserved. For help type #help;; > #light;; > let Additional = (fun i j -> i + j);; val Additional : int -> int -> int > let sum = Additional 3 5;; val sum : int = 8 > printf "%d" sum;; 8val it : unit = () > #quit;; - Exit... $
5 comments:
I followed all your steps, but when I ran fsi and tried to enter any commands at all, whether they be #light;; or expressions, the interpreter hangs indefinitely. Any idea why?
No ideas. How about you doing a bug report for FSharp team?
http://fsxplat.codeplex.com/
If it hands try:
alias fsi='mono /Library/Frameworks/Mono.framework/FSharp/bin/fsi.exe --gui- --readline+'
Installing F# on Mac OSX is now really easy, a one step install - see http://fsharp.org
You use 'fsharpi' to run F# interactive
OK, I see. It is insanely easy :-)
Post a Comment