01 December 2018

Setup MAME 0.204 from scratch on Macs (Update December 2018)

Another update on how to configure MAME from scratch via its internal interface MEWUI (default MAME UI since 0.171) and a text editor.  
If you are willing to work with your Terminal and a Text Editor, it is just the best way to set up and maintain MAME, irrespective of which frontend you wanna use later on.
So let's go step by step from scratch. 
MEWUI - click to enlarge
Step 1 - Basic Homework 

Download and install SDL 2 as explained here. Download a good text editor - I prefer TextWrangler from the Mac App Store (which is phased out now, so I have to look for a new one). Change Finder Settings in order to Display Hidden Folders and Files, e.g. with Deeper (you need access to your User Library folder, which is by default a hidden folder). Of course, download MAME from here and unzip it into the place of your choice. Obviously this is the SDL version of MAME complied for Macs.

Recommendation: I currently keep my running MAME version in the folder 'mame' and keep only older versions in a version-related directory. This definitely helps you further on to stay consistent and carry on your work from version to version.

Step 2 - Create .ini files in the Terminal and manually configure ini paths

After a lot of testing, my recommendation is to create your first .ini files from the Terminal. This should save you from a lot of headache by multiple .ini files that just cause confusion.

  • Start Terminal and cd into your directory of MAME (recommendation: name your main directory mame, see above)
  • Now in the Terminal and in the right directory, the command ./mame64 -cc generates the three default config files in your mame directory:
mame.ini - your overall configuration file for MAME
plugin.ini - your configuration file for activating and deactivating MAME Plugins
ui.ini - your configuration file for the MEWUI interface
  • By default, mame.ini contains the following multiple ini paths:
inipath  "$HOME/Library/Application Support/mame;$HOME/.mame;.;ini"
In my own experience, this is rather unfortunate, because you may end up with multiple .ini files at multiple places rather easily. Since MAME then considers all these .ini files in a certain order, you may be lost in chaos. Right now, I actually prefer having all .ini files in the MAME sub-directory called ini, thus I reduce this line as follows:
inipath                   ini
This means of course that you have to move the three .ini files created in the first step into the ini subdirectory. As long as you do not forget about the ini directory when moving to a new MAME version, this is probably easiest to handle, and the /Library/Application Support directory stays clean of MAME config files.
 Step 3 - Start MEWUI (the right way)

Open Terminal and switch to your MAME working directory (easiest way: type 'cd' and then drag the mame directory from the Finder into the Terminal -> press Return in the Terminal window)

Warning: starting mame64 with double-click works, but you are not in the MAME working directory, so a lot just does not work -> start via Terminal as explained here. So you must be in the MAME working directory!

Step 4 - Configuration of shaders in a text editor 

Below I make reference to the line number in my 0.191 mame.ini file - the comments in brackets and italic are just explanations, do not include them in the mame.ini file!!!

Option 1 - Settings in mame.ini for BGFX/CRT-GEOM-DELUXE (explained here):
4   readconfig     1 (leave it as is -> tells MAME to read out this ini and other ini files)
91  artwork_crop   0  (no crop of modern bezels; 1 if you want to crop 4:3 artwork for 16:9)
191 plugins        1 (if enabled, the settings in plugin.ini should work)
243 video          bgfx (switch shaders to bgfx, crucial in macOS)
245 window         0 (start MAME in fullscreen; 1 = windowed mode, less performance)
348 bgfx_backend   metal (opengl if metal does not work on your Mac)
350 bgfx_screen_chains crt-geom-deluxe (or hlsl if your Mac has the power)
Note: In BGFX, Bilinear Filtering seems to be irrelevant.
That is basically it! With this settings in your mame.ini, you are ready for a BGFX, enabled MAME environment.

Option 2 - Settings in mame.ini for BGFX/HLSL (explained here):
350 bgfx_screen_chains hlsl
Consider tweaking HLSL for performance improvements, as explained here.

Option 3 - OpenGL settings in mame.ini for GLSL/CRT-GEOM-DELUXE 
(WARNING: Does no longer seem to work in my current MacOS environment)

GLSL is still the performance king, and the CRT-GEOM-DELUXE shaders discussed here rock. You need to download the shaders as explained here. Im my case, they are located in an own directory of mame called CRT-GEOM-DELUXE.

These changes of mame.ini are required. You can prepare these changes as well and leave MAME with BGFX by changing everything except for the first line 243.
243 video       opengl (switch shaders to OpenGL)
291 gl_vbo      1
292 gl_pbo      1
293 gl_glsl     1
294 gl_glsl_filter 1
295 glsl_shader_mame0   /Users/stefan/Games/mame/CRT-GEOM-DELUXE/Gaussx
296  glsl_shader_mame1 /Users/stefan/Games/mame/CRT-GEOM-DELUXE/Gaussy
297  glsl_shader_mame2  /Users/stefan/Games/mame/CRT-GEOM-DELUXE/CRT-geom-halation

So these shaders are called in a sequence of three. Obviously, you need to include your own correct file path instead of mine.

For vertical games (see Step 4a below as regards specific game inis):
297  glsl_shader_mame2   /Users/stefan/Games/mame/CRT-GEOM-DELUXE/CRT-geom-halation_Vertical

Important: Never include the file ending .vsh or .fsh - it would not work.

Also consider to tweak the settings of both crt-geom-halation.vsh and crt-geom-halation_Vertical.vsh as described here.

Step 4a - Different Configs for Single Games

Some games work better with different shaders, or they need the waitvsync option as described here.  Also here the manual setup of MAME shines - and you do that for any frontend you may make use of afterwards. 

Name convention: (game name).ini
Directory: (Username)/Library/Application Support/mame/ (same as mame.ini)

The best way is to copy/paste your mame.ini - as soon as your mame.ini is ready. This is also a very nice way to test new mame.ini settings just with one game.

Example - I created a 1942.ini from my ready mame.ini in order to change the following settings:
62   speed    1.0 (waitvsync always works together with speed, but in the case of 1942, no speed adjustment is required - see the above link)
247  waitvsync 1 (activate waitvsync to stop bleeding in 1942)

Step 5 - Setup Joystick inside of MAME: 

This is probably the best time to set up your joypad for MAME - as described here. If everything works out nicely, you will from now on move the configuration file named /cfg/default.cfg into the subsequent versions.

Step 6 - Setup Artwork/Overlays inside of MAME: 

Besides a decent shader, artwork is the second most important tweak for me to get a real arcade feeling on your Mac. In this Blog, you will find a lot about tweaking Artwork for your Mac:
My Post about realistic Bezel Artwork for MAME
The most 'official' MAME Artwork directory is here:
When downloading, be sure that you always head for the 16:9 artwork, where available.
Place the .zip files into the Artwork directory, and you should be done.

Step 7 - Look for a Frontend

Right now, Mac users can only decide between QMC2 and Attract Mode. While both are great and work very stable, they always lag a bit behind the Windows and sometimes Linux world. Still both are good choices, and you will find tons of information about how to set up these frontends on your Mac.

Important note for QMC2: Since you configured your standard settings in mame.ini, you need to configure readconfig in QMC2's Global Configuration Settings to "1" and reset QMC2's settings to default settings.

Be careful: QMC2 settings can override mame.ini, so in case of a conflict, set QMC2 settings identical to mame.ini.
Advantage: You have identical settings in different frontends, e.g. QMC2 and Attract Mode.

Of course you can move ahead with MEWUI, which is built into mame64. Then you might want to do the following:

./mame64 Automation: Create a script containing these two lines:
cd /xxxxxxx/xxxxxxx/xxxxx/mame
(of course the xxxxx are placeholders for your directory - and assuming that your directory is mame)
Save it under the filename MAME64.command and make it executable via chmod +x. From now on you can start MEWUI from the Finder it by double-clicking this script.

Conclusion: If you get familiar with this setup, you will never be faster in any frontend. It is by far the most preferable way of setting up MAME because you exactly know what you are doing. There are also some advantages over configuring from within QMC2: 
  • You configure the new MAME plugins in the UI, so you can e.g. turn on the new highscore LUA-support -> that one really rocks.
  • joystick works out of the box, it works in the UI without configuration, I just had to configure P1 coin, P1 start and UI exit as described here and everything is in place for moving things without the keyboard - niiiiiice
  • You set a very solid groundwork for a frontend such as Attract Mode, as explained here and here.


  1. One thing to note. When using NEWUI and you configure it how you want, when/if you choose save configuration, the changes are saved to ~/Library/Application Support/mame/mame.ini, not the mame.ini in the current directory. This isn't an issue normally, since by default all mame.ini files are set to read the one in Application Support folder first.

    1. Correct, this path is the default path for SDL MAME on OSX, thanks, I clarified

  2. I am a rookie to this process. Is there an easier way to set this up?

    1. Sure! Look down for the first two posts (Welcome and Setup with QMC2) and you should be fine. You are right that this setup here is a more advanced approach, but the work spent here gives you much more stability later on. Sorry for the later response- your anonymous posting landed in Spam ;-)

  3. I would like name to be available to all users on the machine, so I put it in /Applications/mame instead of under my user home directory like you have. is this OK or will there be problems later?

    1. You are right, there is no real drawback, just the size of the directory - depending upon the amount of your roms and other data. I am unsure about the impact of a too large Apps directory. Alternatively you could place the directory under Users/shared - Ann all users would have access.

  4. Is there any way of removing the Cabinets, Control Panel, PCBs, Ends, Bosses from the right column of MEWUI?


Any comments are welcome!