Once again, I've revised the build instructions for SDLMAME on Mac OS X.

As always, if you spot any glaring errors/omissions/outright lies, please let me know.

Also, if anyone would be interested in reposting this on their site. please let me know that as well... smile


Building SDLMAME for Mac OS X - A Guide

Welcome to the world of SDLMAME. If you've built SDLMAME for Mac OS X in the past, you'll notice that since version 0.136u1, the build procedures have changed.

If you're new to building (compiling) SDLMAME on Mac OS X, with any luck, you'll find it's not as difficult as you might think.

Either way, Don't Panic! This guide will (hopefully) get you up and running in fairly short order.

Let's get started...

Step 0 - Preliminary Steps - (These need be done only once, with the occasional periodic updates) -

0a) Run Software Update
Your Operating System, and supporting files should be updated prior to compiling SDLMAME (and should be kept up to date regardless) The minimum supported OS for SDLMAME under Mac OS X is 10.7.x (Snow Leopard).

0b) Install/Update Xcode
Xcode is a free developer environment from Apple, and although it will be used to compile SDLMAME, you will not be required to learn how to run it.
It will need to be installed prior to compiling SDLMAME. As of this writing (November 2014) the current version of Xcode is 6.1 (for Mac OS X 10.10 (Yosemite)).
Xcode is free from Apple, in the Mac App Store.

Once you have downloaded Xcode, you'll need to run it. It will download and install a few more pieces at this time. Once it's done, you need to install the command line tools.

On Xcode 6.0 and later, open a Terminal window temporarily and type xcode-select --install and follow the prompts to install the command line tools. (This is a much easier version of this step that I recently found out about).

0c) Install/Update SDL
Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and hundreds of Steam games for the Mac and Linux.

Go to http://www.libsdl.org/ , and click the "SDL Releases" download link in the sidebar. Download the "SDL2-2.28.2.dmg" disk image and open it once it downloads.
Click 'Macintosh HD' (or whatever your Mac's hard disk is named) in the left pane of a Finder window, then open the Library folder and drag the SDL2.framework folder from the SDL disk image into the 'Frameworks' folder.

Step 0 Recap -
- Run Software Update
- Install/Update Xcode
- Install/Update SDL2


Step 1 - Gather files

1a) Create folder for build files
While not an absolute necessity, keeping various SDLMAME project files in a separate folder will help to avoid confusion while building. For purposes of this exercise, the folder will be called 'MAME Parts'

1b) Get 'Endings' script
Go to http://rbelmont.mameworld.info/?p=527 and download the 'Endings' file (endings.zip). Place this file in the 'MAME Parts' folder.

1c) Get Baseline MAME source
Go to http://mamedev.org/release.html and download the MAME source file (in zip format). Place this file in the 'MAME Parts' folder.

1d) Get update patch files
Go to http://mamedev.org/updates.html and download any of the diff files you do not already have. Place these files in the 'MAME Parts' folder

1e) Unzip, and place files
Go to the 'MAME Parts' folder. Unzip all the files you downloaded. Do not throw away the original zip files, as you may need them again in the future during the development cycle.
Place the endings file, and all patch files into the MAME Source folder.

Step 1 Recap -
- Create folder for build files
- Get 'Endings' script
- Get Baseline MAME source
- Get update patch files
- Unzip, and place files


Step 2 - Prepare for building

2a) Launch Terminal, and set path
Open the Terminal (Applications->Utilities->Terminal). Type 'cd ' (that's cd, and a space), and drag the MAME Source folder to the Terminal window. Hit 'Return'. This sets the path for the subsequent commands.

2b) Run 'Endings'
Type the following line into the Terminal window (or copy and paste, if you prefer) -


Hit return. Wait for the prompt (This may take a while, and it may appear that nothing is happening... Be patient).

2c) Patch files
This is the variable part of the process, as each 'u' update patch needs to be applied in order to the source.

Type the following into the Terminal window -

patch -p0 <xxxxxxxx (that's [patch], [space], -p[zero], [space], <[diff file name])

Where 'xxxxxxxx' equals the name of the diff file you wish to apply. Hit Return, and wait for the prompt.

Repeat for each diff file in order (u1, u2, u3, etc.)

2d) Check the SDLMAME forums for last minute changes
Before proceeding to the next step, check for any last minute changes/fixex/modifications at the SDLMAME forum at http://www.bannister.org/forums/

Step 2 Recap -
- Launch Terminal, and set path
- Run 'Endings'
- Patch files
- Check the SDLMAME forums for last minute changes


Step 3 - Build

3a) Build
Type the following into the Terminal window -



make -j3 (for dual core processors)


make -j5 (for quad core processors)

Hit Return. SDLMAME will auto detect your system type (32 bit or 64 bit), and build accordingly.

3b) Build Tools
As an option, you can build the optional tools that accompany SDLMAME (chdman, and the like) by typing the following into the Terminal window -

make tools

Hit return.

3c) Enjoy!
Congratulations! You've successfully built SDLMAME on Mac OS X!
You may want to rename the Source folder to reflect the version of SDLMAME you just built.
Attach your favorite front end application, and have fun!

Step 3 Recap -
- Build
- Build Tools
- Enjoy!


Future Builds

Provided no modifications were made to the source prior to building, the next patch may simply be applied to the previous build, and the application built again (you can skip step 2b).

If, however, modifications were made to the source prior to building, it is advisable to start with fresh copies of the source, and all the diff files in order (the latest diff file will usually contain fixes for the previous versions).
If you kept the files from steps 1b, c, and,d, just proceed from step 1d.


Troubleshooting FAQ

- I'm told I need to edit a file in Xcode. How do I do this?
Locate the file to be modified, and double click it. Xcode will open the file.
Chances are good that you were told what line of the code to modify. Under the 'Edit' menu, select 'Go to Line...'. Enter the line number, and click the 'Select' button. Make your modification(s), Save the change(s), and quit Xcode.

- I got an error while building. What do I do?
Check the SDLMAME forums at http://www.bannister.org/forums/ to see if this is a known problem, and if there is a fix available. If not, post a question, and someone will try to help you.
You may also want to try starting over at step 1, especially if you were patching an existing build.

- I got an error while patching the source. What do I do?
Start over from step 1, especially if you're patching an existing build. if you continue to have problems, you may be able to get help at the SDLMAME forums at http://www.bannister.org/forums/

- I had to make a modification of some sort prior to building. Will I have to make this modification again in the next version?
No. However, you may need to start over again with the original source, and latest diff files.

- Is there an easier way to do all this?
If you prefer not to build yourself, prebuilt versions of SDLMAME for Mac OS X are available for download at http://sdlmame.parodius.com/

- I've successfully built SDLMAME in Mac OS X... Now what?
That's a whole 'nother document... wink

Last edited by R. Belmont; 08/17/23 03:50 PM. Reason: Updated to reflect latest SDL2 version.

The following statement is true...
The preceding statement is false.