Psellos
Life So Short, the Craft So Long to Learn

Compile OCaml to iPhone and iPad Simulator

June 5, 2011

Updated: July 15, 2011

Note: I’ve updated this note to link to the updated version of OCamlXSim.

After some prodding from visitors to this site, I realized it would be a great idea to run OCaml on the iPhone/iPad simulator that’s available from Apple. That way people can try out OCaml on iOS without needing a device, or needing to register with Apple as an iOS developer. In fact it would be great tool just for doing OCaml/iOS development.

I just spent a few days getting this to work. After many twists and turns, I found that all you need is a slightly modified version of the stock Mac OS X 32-bit compiler. I’m calling it OCamlXSim for short. If you just want to try out OCamlXSim, I made a standard release package for it (warning: this is a 45 MB file). I also wrote a description of how to build it yourself, and how to test it. The description is here.

To possibly pique your interest further, the above description of OCamlXSim shows how to run applications in the iPhone/iPad Simulator from the command line through an undocumented interface!

The final coup will be to provide an amusing OCaml test app that runs in the simulator. That’s what I’m working on at the moment. I have apps running in the simulator, but I feel they’re not amusing enough. If you can’t wait, email me and I’ll describe how to get the Portland app working (as pictured).

Posted by: Jeffrey