MGFXC 8.3.1 / Wine

Hey Folks,

Since 8.3.1 I have had no luck getting MGFXC to work with Wine on MacOS (x64).

The steps I’m taking:
Install .NET 6 SDK & Runtimes
Install MGFXC Dotnet tool
Install Wine64 & update to 6.0
Run helper script

mgfxc test.fx test.fx.out /Profile:OpenGL

Compilation has never succeeded but have seen it fail in various different ways:
Exits silently, doesn’t compile (most common)
Wine fails to find c:/windows/system32/dotnet.exe (it’s there, I’ve checked!)

I believe this approach worked well using 8.3 (but shaders compiled on 8.3 are not compatible with 8.3.1).

I’ve also failed with similar results on Ubuntu x64 and ARM64. The only success I’ve had was from using Windows (Bootcamped on Mac x64), which suggests the issue lies in compatibility with Wine.

Has anyone had any luck using 8.3.1 version MGFXC with Wine?


1 Like

I had same problem under ubuntu…

I spent about 6 hours trying to fix this under Ubuntu and and couldn’t get it to work (I was pretty frustrated by the end, as you might imagine). I’m using a virtual machine to build my shaders now :frowning:

It seems to be some kind of issue with wine trying to run dotnet as a 32-bit application instead of a 64-bit one for some reason I couldn’t decipher. It fails to find c:/windows/system32/dotnet.exe because it’s actually looking for c:/windows/syswow64/dotnet.exe. Even once I got the 64-bit dotnet executable to run by installing it somewhere else it would still think it’s in 32-bit mode, so MGFXC just instantly crashed anyways.

Don’t know if this helps but I have this pipeline that works with Ubuntu:

Even copy and pasting those exact commands my shaders still wont build. I have no idea how to debug this because it seems to be something external to monogame, and even messing with WineHelper.cs in MonoGame.Effect.Compiler I couldn’t make any progress.
I updated to Ubuntu 22.04 at the same time I updated to monogame 3.8.1, maybe it’s an issue with specific wine versions?

I experimented with Wine versions 5.0, 6.0 and 7.0 in various different environments, the specific errors varied slightly but still no success.

I think I figured it out! Not sure why I didn’t check this earlier but for some reason the downloads the 32-bit version of dotnet than puts it in the 64-bit system32! Let me know if this works for you; delete ~/.winemonogame then replace line 32 of with


Then run run the script and your shaders should now build. I’ve created an issues and pr on github here `` downloads the x86 dotnet exectuable instead of the x64 exectuable · Issue #7898 · MonoGame/MonoGame · GitHub


This worked for me too! Great spot! (although slightly frustrated I didn’t spot this myself :wink:).

When building with Visual Studio for Mac, environment variables set in ~/.zprofile or ~/.profile are not read.

I have successfully built with Visual Studio for Mac by setting the MGFXC_WINE_PATH environment variable at MacOS login using the following method.

create .plist file
vi ~/Library/LaunchAgents/mgfxc_wine_path.plist

file contents

<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “”>
<plist version=“1.0”>

launchctl setenv MGFXC_WINE_PATH "$HOME/.winemonogame"

Once you have created the file, please logout or restart macOS.

1 Like

thank you all I did not understand the suggestions
it works now
thanks again :+1:

This works on Debian 11, too.
compiled GeonBit.UI examples.

THANKS! this is what it finally took to get it running on Ubuntu for me

1 Like

Hey, super helpful page, thanks!

I’m having trouble getting it to work though. It appears that all the steps go through, but when I actually go to compile shaders (after the Setup Wine step), I get mgfxc: command not found

I noticed that the actual shader compilation is not in the script. Is it in a build action for you?

Looks like the issue was fixed in develop. Here is my current working script:

As a user of an older version of macOS (10.14), I had to do a couple extra things. Still can’t compile shaders with MGCB, but I can live with using the command line.

First, I opted to add
echo -e "\nexport MGFXC_WINE_PATH=$HOME/.winemonogame" >> ~/.bash_profile
to the bottom of the installer script. I removed the other shell profile updates, but you could leave them.

Also, I commented out the whole block where it’s downloading d3dcompiler_47.dll from a Firefox installer (???), as this step never worked for me. I copied in d3dcompiler_47.dll from somewhere else, but I’m not sure this was necessary as it was already present in .winemonogame/drive_c/windows/system32/

At this point it may work for you.

For whatever reason, I also needed to run:
WINEPREFIX=$HOME/.winemonogame winetricks dotnetcore3
You could also install this globally without the prefix.

If you’re having a lot of trouble with wine not running or freaking out, it may be helpful to delete or rename ~/.wine and or ~/.winemonogame and start fresh. Running winecfg rebuilds ~/.wine

I had a lot of trouble with like 8 instances of wine64-preloader sticking around after something would fail, so in this case you log out and back in or quit them in activity monitor. I believe you should not force quit wine-server.