Categories
Haxe

Installing Haxe and NME on OSX

I recently had to (uninstall and) reinstall Haxe, so I decided that it would be useful to document the process!

Remember this is a post for OSX(10.6.8) install of Haxe(2.09) and NME(3.3.0)!

This entire post started because MonoDevelop didn’t show any auto-completion anymore. It cost me 4 nights to fix the ‘problem’. I deleted Haxe entirely and reinstalled it (and NME/extra libraries) again. I had written the process of install down before to blog about it later, so there is some stuff that happened the previous time I install Haxe and NME (and that means that this it’s not exactly a clean install)

About the deletion/uninstall of Haxe: at the bottom of the post

I can’t thank Joshua Granick (one of the programmers of NME) enough for his help! The man must be a superhero: helping everybody on twitter, writing tutorials/post on his blog, programming an haxe/nme add-in for MonoDevelop, NME (duh), being a dad, having his own game company….(!!)

Start installing Haxe

Download the Haxe OSX install zip from: http://haxe.org/download
And install it like you normally do.

After install you can check if everything went okay (and you need the terminal later on):
open the terminal
(CMD+SPACE and type terminal)

type in the terminal
haxe
to check the install

Download the NME OSX install zip from: http://www.haxenme.org/download/
And install.

type in the terminal
haxelib list
to check what libraries are installed

This is probably not useful for everybody, but these are some of the extra libraries I use…
type in the terminal

haxelib install swf
haxelib install jeash
haxelib install spritesheet
haxelib install format
haxelib install actuate
haxelib install box2d
haxelib install waxe

You probably only want to install these to get NME working
jeash for html5 and actuate to animate stuff

haxelib install jeash
haxelib install actuate

Next we will make a short cut to NME
Type in the terminal
haxelib run nme setup

Explanation from Joshua Granick

If you execute “haxelib run nme setup” from a command-line or terminal, it will add a script to your PATH (in the Haxe directory) that shortens the command string. Instead of having to call “haxelib run nme”, you can simply call “nme”.

This failed on my computer; the terminal spit this back at me

haxelib run nme setup
chmod: Unable to change file mode on /usr/lib/haxe/nme: Operation not permitted
rm: /usr/bin/nme: Permission denied
ln: /usr/bin/nme: File exists

This is probably because I’m on OSX and not on Linux as “root” user….
So fix this with:
sudo haxelib run nme setup, type your password and try again!
(source: http://www.haxenme.org/developers/get-started/)

After this you install the ‘stuff’ you need for development on mobile devices.
I only need android so I installed that (for now):

nme setup android
Download and install the Android SDK? [y/n/a] ? y
Output directory [/opt/Android SDK] : /opt/Android SDK
or just use enter to use the default path

after install the “Android SDK Manager” will be started

download Android 4.0.3 (API 15)

After the “Android SDK Manager” is ready with downloading and install you can close it (it will ask you to do so)

The terminal will start yelling stuff:
Download and install the Android NDK? [y/n/a] ? y
Path to Android NDK [/opt/Android NDK] : /opt/Android NDK
or just use enter to use the default path

Okay.. your good to go!

Install IDE

Install an IDE (read about the choices that I made)

Let’s assume that you will also use MonoDevelop (2.8.8.4):
Download the OSX files (yes 2!) from: http://monodevelop.com/Download
Click on osx and you will get two download options

  • MonoDevelop 2.8.8.4 installer
  • Mono 2.10.5 + GTK#

Click/Download MonoDevelop (pretty straight forward)
Click on Mono and you will go here http://www.go-mono.com/mono-downloads/download.html.
Do you need “An open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET”???
Well… yes: see Mono as the car-engine and MonoDevelop as the rest of the car (you as the driver)… you need both to go on a road trip!

We want stable release: “Latest Stable Version: 2.10.8” and click again on OSX.
At the bottom of the page you will see some links appears
download the Intel Mac: “Runtime”

Install both files you just downloaded
And open MonoDevelop (in Applications)!

Add-in Manager Monodevelop
The only thing you need to do now is:
MonoDevelop > Add-in Manager > Gallery tab > Language bindings > Haxe language Binding
Install that add-in (0.2.1).

Your MonoDevelop is ready for Haxe/NME programming.
Moving from FDT to MonoDevelop? I wrote something about that to make it somewhat easier: Moving from FDT to Monodevelop for Haxe and NME

About your first NME > Flash project, visit Joshua Granick post: getting-started-with-haxeflash-in-monodevelop/ he has also one form cpp and html5..

Happy Haxe-ing

Uninstall Haxe on OSX

something you should never do 😀

After updating to Haxe 2.09 (and updated the Add-in) I noticed that the MonoDevelop auto-completion didn’t work anymore.
I mentioned this to Joshua Granick but we couldn’t figur out what it was.

This is probably what happend: I installed Haxe 2.09 very quickly after it was released and after that there was a hotfix which I couldn’t install over the previous installed Haxe…
Eventually Joshua gave me this advice on twitter.

Open the terminal (CMD+SPACE and type terminal) and typerm /usr/bin/haxe
I got “rm: /usr/bin/haxe: Permission denied”
This is probably because I’m on OSX and not on Linux as “root” user….
I fixed this with sudo rm /usr/bin/haxe: you will be asked to fill in you password (there is no feedback of typing) and hit enter, the Haxe folder will be deleted.
(you will lose Haxe and everything you installed in there: NME and libraries, the other install you need to do for NME will still be installed: Android/IOS for example)

After the reinstall everything worked again.
I can finally use my evenings for programming again 😀

3 replies on “Installing Haxe and NME on OSX”

Hey Matthijs!

Thanks for the blogpost, very good information here, i also had the autocompletion problem so it’s good to have all the steps consolidated here.

I have one problem though, when working on a NME project, using monoDevelop. when i deploy it breaks trying to build for Android… is there a way to specify to which platforms i want to deploy to? i want only to do HTML5 and Flash with Haxe and NME… or at least how can i fix the Android issue ..

/opt/Android SDK/tools/ant/build.xml(-1): Error: Unable to resolve target ‘android-8’

Thanks!.

Thanks! I have to agree with Chris Foster – the repositories in MonoDevelop didn’t bring up anything for me.

Comments are closed.