Building a x64 DOSBox binary for macOS Sierra

Running DOSBox after a long time made me wonder if there isn’t a newer version for mac OS X / OS X / macOS available, preferably for x64. Looking through the DOSBox Wiki I did find a download link for a Mac OS X / OS X / macOS binary but that was an universal binary build for ppc / i386 (32bit). The last official release of DOSBox for this platform was version 0.74-1 released on the 20th September 2012, quite some time ago…

So I wondered if it would be very difficult to compile a current version of DOSBox for myself and maybe end up with a x64 binary which also might emulate things better and/or faster.

To begin with, I have set up a fresh virtual machine running macOS Sierra and installed Xcode 8.0 (8A218a). To save me from misery later on I decided it might me a good idea to make a snapshot so if things do go horribly wrong I can always revert to a fresh start. Better safe than sorry .. :-) So without much further ado, this is how I did it:

Notice: Everything is done via shell so you either can run “Terminal.app” locally on your Apple computer or ssh into your build machine (I did the latter).

Obtaining the source code

$ cd $HOME/Desktop
$ mkdir build
$ cd build
$ svn checkout svn://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk dosbox-code-0
$ cd dosbox-code-0

The source code does not have a configure script readily available so we need to provide
the tools for autogen.sh to run successfully

Obtaining autoconf

$ cd $HOME/Desktop/build
$ curl -LOs http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
$ tar xzpf autoconf-2.69.tar.gz
$ cd autoconf-2.69
$ ./configure
$ make
$ sudo make install

Obtaining automake

$ cd $HOME/Desktop/build
$ curl -LOs http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz
$ tar xzpf automake-1.15.tar.gz
$ cd automake-1.15
$./configure
$ make
$ sudo make install

DOSBox wants SDL 1.2.x so provide that too

$ cd $HOME/Desktop/build
$ curl -LOs https://www.libsdl.org/release/SDL-1.2.15.tar.gz
$ tar xzpf SDL-1.2.15.tar.gz
$ cd SDL-1.2.15
$ ./configure --prefix=$HOME/Desktop/staticbuild --enable-static --disable-shared --disable-video-x11
$ perl -p -i -e "/CGDirectPaletteRef palette;/d" ./src/video/quartz/SDL_QuartzVideo.h
$ make
$ make install

Compiling DOSBox

$ cd $HOME/Desktop/build/dosbox-code-0/
$ DOSBOXVERSION=$(svn log | head -2 | awk '/^r/ { print $1 }')
$ ./autogen.sh
$ ./configure --with-sdl-prefix=$HOME/Desktop/staticbuild/
$ make

Reaching this step, a fully functional DOSBox binary is available but why not just try and package it up into an Application and disk image? For this, I did cheat by using the old stable disk image provided by the DOSBox Team as a template which did save me some effort.

Getting the 0.74-1 DOSBox disk image

$ cd $HOME/Desktop
$ curl -LOs http://heanet.dl.sourceforge.net/project/dosbox/dosbox/0.74/DOSBox-0.74-1_Universal.dmg
$ hdiutil attach DOSBox-0.74-1_Universal.dmg
$ cp -R /Volumes/DOSBox\ 0.74-1/DOSBox.app $HOME/Desktop/
$ diskutil eject /Volumes/DOSBox\ 0.74-1/

Copying the newly created binary into the DOSBox.app

$ cp $HOME/Desktop/build/dosbox-code-0/src/dosbox $HOME/Desktop//DOSBox.app/Contents/MacOS/DOSBox

Fixing the package version information

$ /usr/libexec/PlistBuddy -c "Set :CFBundleGetInfoString ${DOSBOXVERSION}, Copyright 2010-2016 The DOSBox Team, compiled by snowy" $HOME/Desktop//DOSBox.app/Contents/Info.plist
$ /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $DOSBOXVERSION" $HOME/Desktop//DOSBox.app/Contents/Info.plist
$ /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $DOSBOXVERSION" $HOME/Desktop//DOSBox.app/Contents/Info.plist
$ /usr/libexec/PlistBuddy -c "Set :NSHumanReadableCopyright Copyright 2002-2016 The DOSBox Team, compiled by snowy" $HOME/Desktop//DOSBox.app/Contents/Info.plist

Creating the disk image

$ cd $HOME/Desktop
$ mkdir DMGSRC

At this stage you could put the manual, the GPL, a version history, a README, example configurations or anything else you think might be important to the user into the DMGSRC directory if you wanted to make a complete and unofficial distribution of DOSBox.

$ mv DOSBox.app DMGSRC/
$ hdiutil create -volname DOSBox-${DOSBOXVERSION} -srcfolder $HOME/Desktop/DMGSRC DOSBox-${DOSBOXVERSION}
$ cd $HOME/Desktop
$ rm DOSBox-0.74-1_Universal.dmg
$ rm -rf staticbuild
$ rm -rf build
$ rm -rf DMGSRC

And now you are ready to go. copy the disk image to your main machine and drop the DOSBox.app into /Applications or any other place you would like to keep it. Run it once and if you already have a DOSBosx 0.74 configuration, you can point the new configuration to the old one by executing the following commands

$ cd $HOME/Library/Preferences
$ rm "DOSBox SVN Preferences"
$ ln -s "DOSBox 0.74 Preferences" "DOSBox SVN Preferences"

For lot’s of fun with DOSBox I recommend reading Compile like it’s 1992 by Fabien Sanglard.

18 thoughts on “Building a x64 DOSBox binary for macOS Sierra

  1. Thank you for writing this! In my case I saved myself some hassle by using homebrew to install the dependencies.

    • I think HomeBrew is a really good project and for the three dependencies (autoconf, automake and SDL) I do not think you really needed the full HomeBrew setup :-)

  2. Since I’m the guy who does the Dosbox snapshots, there is a simple reason that Dosbox is not built in 64bit: the dynamic core is made for 32bit and the 64bit adaption isn’t as capable. You should have noticed that the 64bit built is much slower on OS X than the 32bit one.

    • When I looked for a current build I saw your snapshots but as they were marked for 10.4-10.7 ppc/intel I did not check how current they were. My main motivation to build DOSBox from the svn repository was to fix a graphics problem with Command and Conquer Red Alert which did go away in r4000. I do not play that often and have not noticed that the r4000 64bit DOSBox is considerably slower than the 0.74 public release but that is just a very subjective impression. Do you know of any plans to make the 64bit dynamic core more stable?

    • I am in a similar situation to hexeract; I have not experienced any noticeable performance loss when building 64-bit from SVN. I have also been doing so in the last few months because of planned deprecation of 32-bit applications in macOS (see: https://apple.slashdot.org/story/17/06/07/0538233/apple-to-phase-out-32-bit-mac-apps-starting-in-january-2018). While no one knows the details of this plan as of yet, do you know whether the DOSBox team plans to release a 64-bit stable build in the future?

  3. With the introduction of high sierra and macOS going all 64bit in 2018, will this version work? I’m already losing a lot of iOS apps if I swap to 11, I would hate to lose dosbox games on my mac.

    • It depends if High Sierra will just issue a warning or will simply not run 32bit applications.

      If you build DOSBox following my posting you should end up with a 64bit binary:


      $ file DOSBox
      DOSBox: Mach-O 64-bit executable x86_64

    • I have built DOSBox/DOSBox-x on MacOS 10.14 (Mojave) without any issues.

      Enabling the debugger should be as easy as adding the correct configure flag –enable-debug or –enable-debug=heavy
      (Source https://www.vogons.org/viewtopic.php?t=3944 )

      Building with the latter flag did produce a DMG image for me: DOSBox-r4218.dmg

      Double Clicking on the Icon did not start DOSBox but when I executed it from the command line:
      ./DOSBox.app/Contents/MacOS/DOSBox it did show a DOSBox window and a separate debugging window.

      As on how to use the debuggerI can only point you to the resource above…

      Hope this information helps.

  4. This script is great. Almost worked, the problem is that MAC OS Mojave and SDL-1.2.15 are not compatible, SDL 2.2. works only, and for Dosbox it is too good. I only need to compile the source because I need FILES=255 to run my old foxpro programs and Dosbox comes with FILES=127 (its set in \include\dos_inc.h DOS_FILES 127, so to change that, I need to compile it with DOS_FILES 255). Do you hav any idea how to circumvent this SDL issue compiling in MAC OS MOJAVE?

    • I had the same experience. With Mojave everything fell apart when building DOSBox (SDL 1.2.x wanting X11 which is not available on Mojave).
      Also, you may have seen there is a fork called DOSBox-X (https://dosbox-x.com) which you may want to try (at first glance it seemed to compile on Catalina with a ton of warnings).

Leave a Reply to robbo007 Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s