MonoGame development on macOS

First post here.

A few years ago I tried to use MonoGame on macOS, but at that time it seemed the MonoGame SDK still relied on Windows for some stuff (e.g. asset pipeline).

My question is … is it possible now to do the whole MonoGame development process on macOS or would a Windows platform still be required for parts of the development process?

I really don’t want to bother with bootcamp or a 2nd Windows computer and for me this was a dealbreaker at the time.

As MonoGame 3.8 went full .NETCore, you don’t even need a IDE to start making games on any desktop platform, including on a Mac. (High Sierra and up!!)

Firstly install .NETCore 3.1 for Mac: Download .NET Core 3.1 SDK (v3.1.404) - macOS x64 Installer

Once installed, go to terminal and type to install the templates:

dotnet new -i MonoGame.Templates.CSharp::3.8.0.1641

Choose a location to create your monogame game project and type:

dotnet new mgdesktopgl -o YourGameFolderName

Then go to your newly game folder location:

cd YourGameFolderName

Install monogame content builder:

dotnet tool install --global dotnet-mgcb --version 3.8.0.1641

Install monogame content builder editor:

dotnet tool install --global dotnet-mgcb-editor --version 3.8.0.1641

Register it:

mgcb-editor --register

Open the mgcb-editor to manage and build your game assets: sprites, sounds, music, etc.

mgcb-editor

Then you simply type to build your game:

dotnet build

Or/and type to run/test your game:

dotnet run

and then finally publish the game to any desktop platform you want:

dotnet publish -r osx-x64 -c Release

dotnet publish -r win-x64 -c Release

dotnet publish -r linux-x64 -c Release

EDIT: You also can build a single file for distribution adding /p:PublishSingleFile=true at the end of the line. Ex:

dotnet publish -r osx-x64 -c Release /p:PublishSingleFile=true

Then just go to YourGamerFolder/bin/release folder and the binary is now ready to distribute :slight_smile:

MonoGame also supports iOS and Android, but it relies on Xamarin, so development using Visual Studio for Mac will be mandatory. Hope it helps!

4 Likes

Hey Ivan, that’s very good to hear.

I’m gonna follow your instructions today and see if all works accordingly.

It’s no problem to have Visual Studio installed. For the last few years I’ve mainly been working as a Xamarin dev. It’s very good to hear no IDE is needed though. Perhaps I can develop just using Sublime Text or something? That would be cool. Though in the past I tried some extensions for SublimeText to do C# dev, but they were kinda buggy. Might be fixed now, it’s worth a try.

Yep, I recently got a Mac, It was harder to me setting up MonoGame 3.8 in VSCode and VS for Mac then to simply use dotnet commands on terminal and everything works fine :slight_smile: Brought my 3.8 project from Linux but sadly I couldn’t make it work properly on Mac, so I created a new project here to import all the stuff from the other one. Hope it works out for you too :wink:

Edit: About the text editors, yes, you can use Ominsharp extension: http://www.omnisharp.net/ I used it along with VSCodium and it worked great

Edit2: As I created a cross-platform MonoGame project, it should work on Mac, Linux and Windows. But when I tried to open it on Mac, it gave me a resolution error. Problem was I didn’t implement full screen resolution properly, so I did it now and it works as it should :slight_smile:

Hi Ivan,

Just wanted to confirm your solution works for me as well. I just followed all steps. Excellent!

1 Like

I’m glad it worked out for you! Another finding and fix I want to share in case you (or anyone) end up having some headache with the same error:

This applies only on MGCB-Editor (not on Terminal):
In case you import all the assets of your project inside mcgb-editor: When you start Building them, you may get some errors regarding “DS_Store file not being able to find a default importer”. This is a file created automatically only on Mac to store folder info. As it’s not relevant for the game project, you must find and delete those “DS_Store” files. Once deleted, Clean the project and Build it again. It’ll be fixed in no time :slight_smile:

EDIT: Updated some info above and also how to build a single file for distribution :slight_smile:

2 Likes

Have you tried to open MGCB-Editor on macOS Sonoma? It’s not opening an my Intel iMac on macOS Sonoma.

1 Like