Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin's F# interactive pad cannot find mono

Tags:

mono

xamarin

f#

On OSX.

When I open the pad I get this error message: /Library/Frameworks/Mono.framework/Versions/4.0.4/bin/fsharpi: line 24: exec: mono: not found

However I can build and run F# programs, so Xamarin obviously does find mono.

like image 474
bulldog_in_the_dream Avatar asked Mar 14 '23 16:03

bulldog_in_the_dream


1 Answers

I had the same issue and managed to solve it as follows: fsharpi is a shell script; it fails on line 24:

$EXEC mono $DEBUG $MONO_OPTIONS /Library/Frameworks/Mono.framework/Versions/4.0.4/lib/mono/4.5/fsi.exe --exename:$(basename "$0") "$@"

Apparently, when Xamarin launch fsharpi it does not find the mono executable, even if apparently the $PATH variable is correctly set and fsharpi can be launched from the terminal. On my mac the mono executable is located at "/Library/Frameworks/Mono.framework/Commands/mono", so my fix has been to replace the line with the following:

MONO="/Library/Frameworks/Mono.framework/Commands/mono"
$EXEC $MONO $DEBUG $MONO_OPTIONS /Library/Frameworks/Mono.framework/Versions/4.0.4/lib/mono/4.5/fsi.exe --exename:$(basename "$0") "$@"

It is not the most elegant solution, but there already was the fsi.exe path hardcoded in the script, so I think it is acceptable.

like image 68
Roberto Giaccio Avatar answered Mar 24 '23 18:03

Roberto Giaccio