Friday, January 31, 2014

Tutorial: Setting up and running MonoGame on MacOS X

This is an overview and guide/tutorial of the process of both installing MonoGame on Macintosh, and creating a MonoGame project that actually runs. I will be using MonoGame 3.0.1, the January 31, 2014 MonoGame source, and MacOS X 10.8.5 for the purpose of this tutorial.

Before I begin, a disclaimer: currently, to actually deploy and publish games to Macintosh (or iOS or Android) using MonoGame, you will need to buy a Xamarin License. MonoGame has far more code than the limited amount the starter edition allows. MonoGame are currently working on getting whitelisted, but currently, as of February 1, 2014, you need to purchase at least the 300$ version of Xamarin. Testing your games will still work, you just cannot publish them.

Anyway, with that out of the way, let us begin.

1) The first thing you need to do is install Xcode on Mac if you do not already have it. You can get it from here: https://developer.apple.com/downloads/index.action .If you are running Mountain Lion like me, you want 4.6.3. Otherwise, just get the version for whatever version you are running.

2) Next you need MonoDevelop, which you can get from the MonoDevelop website: http://monodevelop.com/ . Download the MacOSX version, obviously. You also need to install Mono + GTK#, which is right below the MonoDevelop installer. For me, it is Xamarin Studio 4.2.2. The Mono download link will take you to a different page. You will want to get the Mono MDK.
Installing MonoDevelop

3) Install them in this order: Xcode, Mono, MonoDevelop.
This will take a while, so just be patient if you can. I am very impatient, so waiting is torturous :D. Also, take note of the DMG installing process. Coming from Windows, it is rather weird to me, but easy enough.

4) Next, you need to download the MonoGame framework, as you might expect. Go to https://github.com/mono/MonoGame  and download the Zip.
On a side note, I like Macs auto decompressing of zips.

4.1) Next, you should get the MonoGame 3.0.1 mpack for the templates. Go to the MonoGame Codeplex which is located here: http://monogame.codeplex.com/ and go to downloads and download the MonoGame 3.0.1 for Xamarin Studio.

Then go to Xamarin Studio and click the Xamarin Studio next to file in the application bar. Go to Add-in Manager, select add from file, and navigate to, and select the file you just downloaded. Then select to install it.
The Add-in Manager Menu

This gives you the templates, however you still need the source files.

4.2) Go to the MonoGame source zip you downloaded earlier and open MonoGame.Framework.MacOS.sln. Make sure it is that, and not a different file. Then build it by going to Build- Build All.

5) Next go to the blank Xamarin Studio welcome page and and create a new C# MonoGame Mac Application.

5.1) Create it, and open references in the solution explorer. Unselect the MonoGame.Framework reference that is automatically selected.
It must be unselected because it is the Windows reference for some reason

5.5) Add the reference to the MonoGame.Framework.MacOS you just built. To do that, navigate to the folder with the MonoGame source. Then go to MonoGameFramework, then to bin, then to MacOS, then to Debug, then finally select the MonoGame.Framework and Lidgren.Network DLL's and add them.

6) Now If you run the project, it should work, and show the MonoGame logo. It doesn't for me, but that is due to issues with Virtualbox. It should work on an actual Macintosh, or even a hackintosh however.

If you have any questions, comments, feedback, or need further help, please leave a comment below, and I will respond as soon as possible.

1 comment:

  1. As to your 4.2, as of right now (things will change, no doubt) you have to execute

    mono Protobuild.exe

    in order to get MonoGame.Framework.MacOS.sln, amongst other things.

    ReplyDelete