Author Topic: AGS engine Mac OS X port  (Read 69058 times)

Re: AGS engine Mac OS X port
« Reply #160 on: 05 May 2020, 02:51 »
This is amazing work, Dennis, thank you!  This has been the key to help me port several games to the Mac.

I'm having some issues trying to port another game, so I'm guessing the game might be built using AGS 3.5.0 (or whatever is the most current), so I am trying to follow Dennis's instructions above to download and build AGS 3.5.0.  However, I've encountered a couple of issues.

The first stumbling block was trying to run the sed command against the Makefile:

Code: Adventure Game Studio
  1. cd ags-release-3.5.0/OSX/buildlibs && sed -i -e "s/10\.7/10.14/gi" -e "s/-arch i386 //gi" -e "s/;i386//gi" Makefile && cd -
  3. sed: 1: "s/10\.7/10.14/gi": bad flag in substitute command: 'i'

Not sure why this is complaining about the 'i' substitute.  I also tried adding a backslash before the period in "10.14", but this didn't fix the error.  However, I was able to make the updates by opening up the Makefile in a text editor and making the three sets of replacements (change 10.7 to 10.14 and remove the i386 architecture references).

I then moved on to trying to perform the installation, and it appears to have downloaded a bunch of packages, before it failing

Code: Adventure Game Studio
  1. % cd ags-release-3.5.0/OSX/buildlibs && make install && cd -
  2. allegro-4.4.2.tar.gz: OK
  3. dumb-0.9.3.tar.gz: OK
  4. libogg-1.3.2.tar.gz: OK
  5. libtheora-20150828-gfbb2758.tar.bz2: OK
  6. libtheora-20160525-g50df933.tar.bz2: OK
  7. libtremor-20150108-r19427.tar.bz2: OK
  8. libvorbis-1.3.5.tar.gz: OK
  9. lua-5.1.5.tar.gz: OK
  10. ./
  11. make: *** [prepare] Error 1

If I run by itself, no error, so perhaps the next step, or perhaps I am missing something with my system.  Any ideas what might be causing this issue?  Thanks for any tips and assistance.

Best regards,

Chad Armstrong

Is MacOS a fairly up-to-date channel? Is it likely that 3.5.0 might be released for MacOS in the next 6mo?

I already built 3.4.4. I can take a look if I can build 3.5.

I currently can't find the time to integrate my changes properly into the repo, but I'm on it.

Kind regards 

Re: AGS engine Mac OS X port
« Reply #161 on: 05 May 2020, 07:14 »
Hey chad!

Thanks, happy to help. :)

Ah, I'm sorry. I guess, I used the GNU sed version I installed with Homebrew for the command. BSD's sed, which is installed by default on macOS has no case-insensitive search. But actually, that isn't needed anyways. I updated my post with the correct command. Perhaps you can try to rerun the command?

However, I can not reproduce the error you're getting. I get past that and later get errors around a missing freetype library:

Code: Adventure Game Studio
  1. ~/Downloads/ags-v. ➜  make install  
  2. cd /Users/dennis.ploeger/Downloads/ags-v. && ./
  4. allegro-4.4.2.tar.gz:
  6.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  7.                                  Dload  Upload   Total   Spent    Left  Speed
  8. 100 4565k  100 4565k    0     0  1002k      0  0:00:04  0:00:04 --:--:-- 1177k
  10. dumb-0.9.3.tar.gz:
  12.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  13.                                  Dload  Upload   Total   Spent    Left  Speed
  14. 100  163k  100  163k    0     0  74225      0  0:00:02  0:00:02 --:--:-- 74225
  16. libogg-1.3.2.tar.gz:
  18.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  19.                                  Dload  Upload   Total   Spent    Left  Speed
  20. 100  537k  100  537k    0     0   156k      0  0:00:03  0:00:03 --:--:--  156k
  22. libvorbis-1.3.5.tar.gz:
  24.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  25.                                  Dload  Upload   Total   Spent    Left  Speed
  26. 100 1600k  100 1600k    0     0   481k      0  0:00:03  0:00:03 --:--:--  481k
  28. libtheora-20150828-gfbb2758.tar.bz2:
  30.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  31.                                  Dload  Upload   Total   Spent    Left  Speed
  32. 100  996k  100  996k    0     0   157k      0  0:00:06  0:00:06 --:--:--  224k
  34. libtheora-20160525-g50df933.tar.bz2:
  36.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  37.                                  Dload  Upload   Total   Spent    Left  Speed
  38. 100  958k  100  958k    0     0   269k      0  0:00:03  0:00:03 --:--:--  269k
  40. libtremor-20150108-r19427.tar.bz2:
  42.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  43.                                  Dload  Upload   Total   Spent    Left  Speed
  44. 100  122k  100  122k    0     0  49498      0  0:00:02  0:00:02 --:--:-- 49478
  46. lua-5.1.5.tar.gz:
  48.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  49.                                  Dload  Upload   Total   Spent    Left  Speed
  50. 100  216k  100  216k    0     0  93654      0  0:00:02  0:00:02 --:--:-- 93654
  51. allegro-4.4.2.tar.gz: OK
  52. dumb-0.9.3.tar.gz: OK
  53. libogg-1.3.2.tar.gz: OK
  54. libtheora-20150828-gfbb2758.tar.bz2: OK
  55. libtheora-20160525-g50df933.tar.bz2: OK
  56. libtremor-20150108-r19427.tar.bz2: OK
  57. libvorbis-1.3.5.tar.gz: OK
  58. lua-5.1.5.tar.gz: OK
  59. ./
  60. mkdir -p /Users/dennis.ploeger/Downloads/ags-v.
  61. mkdir -p /Users/dennis.ploeger/Downloads/ags-v.
  62. tar xf /Users/dennis.ploeger/Downloads/ags-v. -C /Users/dennis.ploeger/Downloads/ags-v.
  63. cd /Users/dennis.ploeger/Downloads/ags-v. && \
  64.                 patch -p1 < /Users/dennis.ploeger/Downloads/ags-v. && \
  65.                 make macosx INSTALL_TOP="/Users/dennis.ploeger/Downloads/ags-v." PLAT_LDFLAGS="-mmacosx-version-min=10.14 -arch x86_64" PLAT_CFLAGS="-mmacosx-version-min=10.14 -arch x86_64" && \
  66.                 make install INSTALL_TOP="/Users/dennis.ploeger/Downloads/ags-v."
  67. patching file src/Makefile
  68. cd src && /Applications/ macosx
  69. /Applications/ all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
  70. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lapi.o lapi.c
  71. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lcode.o lcode.c
  72. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ldebug.o ldebug.c
  73. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ldo.o ldo.c
  74. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ldump.o ldump.c
  75. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lfunc.o lfunc.c
  76. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lgc.o lgc.c
  77. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o llex.o llex.c
  78. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lmem.o lmem.c
  79. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lobject.o lobject.c
  80. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lopcodes.o lopcodes.c
  81. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lparser.o lparser.c
  82. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lstate.o lstate.c
  83. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lstring.o lstring.c
  84. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ltable.o ltable.c
  85. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ltm.o ltm.c
  86. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lundump.o lundump.c
  87. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lvm.o lvm.c
  88. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lzio.o lzio.c
  89. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lauxlib.o lauxlib.c
  90. lauxlib.c:577:61: warning: while loop has empty body [-Wempty-body]
  91.    while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
  92.                                                             ^
  93. lauxlib.c:577:61: note: put the semicolon on a separate line to silence this warning
  94. 1 warning generated.
  95. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lbaselib.o lbaselib.c
  96. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ldblib.o ldblib.c
  97. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o liolib.o liolib.c
  98. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lmathlib.o lmathlib.c
  99. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o loslib.o loslib.c
  100. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ltablib.o ltablib.c
  101. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lstrlib.o lstrlib.c
  102. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o loadlib.o loadlib.c
  103. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o linit.o linit.c
  104. ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o      # DLL needs all object files
  105. ranlib liblua.a
  106. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lua.o lua.c
  107. gcc -o lua  -mmacosx-version-min=10.14 -arch x86_64 lua.o liblua.a -lm -lreadline
  108. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o luac.o luac.c
  109. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o print.o print.c
  110. gcc -o luac  -mmacosx-version-min=10.14 -arch x86_64 luac.o print.o liblua.a -lm -lreadline
  111. cd src && mkdir -p /Users/dennis.ploeger/Downloads/ags-v. /Users/dennis.ploeger/Downloads/ags-v. /Users/dennis.ploeger/Downloads/ags-v. /Users/dennis.ploeger/Downloads/ags-v. /Users/dennis.ploeger/Downloads/ags-v. /Users/dennis.ploeger/Downloads/ags-v.
  112. cd src && install -p -m 0755 lua luac /Users/dennis.ploeger/Downloads/ags-v.
  113. cd src && install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp /Users/dennis.ploeger/Downloads/ags-v.
  114. cd src && install -p -m 0644 liblua.a /Users/dennis.ploeger/Downloads/ags-v.
  115. cd doc && install -p -m 0644 lua.1 luac.1 /Users/dennis.ploeger/Downloads/ags-v.
  116. tar xf /Users/dennis.ploeger/Downloads/ags-v. -C /Users/dennis.ploeger/Downloads/ags-v.
  117. tar: Error opening archive: Failed to open '/Users/dennis.ploeger/Downloads/ags-v.'
  118. make: *** [freetype] Error 1

I guess there's some dependency, that has not been downloaded. Can't check that right now.

Oh, did you perhaps don't have the xcode command line tools installed? I guess, those are required. Please try to run

Code: Adventure Game Studio
  1. xcode-select --install

first and then try again.

Kind regards

Re: AGS engine Mac OS X port
« Reply #162 on: 05 May 2020, 07:37 »
Oh, to solve the freetype error you have to download to the libsrc directory.

Re: AGS engine Mac OS X port
« Reply #163 on: 06 May 2020, 16:01 »
Thanks for the quick response, Dennis!

I forgot to mention (even though I thought about it while writing the original post) to mention that I am running macOS 10.14.6 using the built in Bash shell.  That you are using a custom version of sed explains the the first issue.

Yes, I have Xcode installed, and I verified that the path looks good.

I don't have freetype, most likely, so that's the next step I'll take.

Best regards,

Chad Armstrong

Oh, to solve the freetype error you have to download to the libsrc directory.
« Last Edit: 07 May 2020, 01:18 by edenwaith »

Re: AGS engine Mac OS X port
« Reply #164 on: 06 May 2020, 18:53 »

I compiled and completely without xcode. Only a few fixes finished and I could play an advjam20-game without problems (so far).

So add freetype like I commented earlier. Also, in Engine/Makefile-defs.osx, add ../Common/libsrc/alfont-2.0.9 to INCDIR in the fourth line.

Then, in the main root run

Code: Adventure Game Studio
  1. make --directory Engine

After that you can find the engine binary as ags in the Engine subfolder.

I have recompiled my App container. You can download it here:

Without XCode I now have means on how to easily compile the engine and will send a PR on github in the next days.


Re: AGS engine Mac OS X port
« Reply #165 on: 06 May 2020, 21:09 »
Aaand here's the PR:

That should fix the OSX build for now and hopefully newer versions.

Re: AGS engine Mac OS X port
« Reply #166 on: 07 May 2020, 01:22 »
Awesome work, Dennis.  I'll test these out and see how things run.

Aaand here's the PR:

That should fix the OSX build for now and hopefully newer versions.

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: AGS engine Mac OS X port
« Reply #167 on: 07 May 2020, 14:41 »
Time to beg!  :=
Do you think you guys could upload the 3.5.0.x engine executable for MacOS somewhere? And since you're there, maybe also the Linux one? (I'm guessing they're not too different but maybe I'm wrong).
Asking for my personal sanity. The learning curve for compiling on Mac is just too much.

Re: AGS engine Mac OS X port
« Reply #169 on: 08 May 2020, 04:58 »
I tried the latest version of the AGS shell app.

The Good:
• It worked with an AGS 3.5.0 game I was trying to port.

The Bad:
• macOS Catalina only (a macOS Mojave build would be nice, I'll see if I can get that working)
• Some of the colors in the game were inverted.  Not sure if it is the game, the engine, or some combo.  I'll need to do some research.

Re: AGS engine Mac OS X port
« Reply #170 on: 08 May 2020, 10:41 »
• Some of the colors in the game were inverted.  Not sure if it is the game, the engine, or some combo.  I'll need to do some research.

I swear, this happens all the time. Each 2-3 years someone fixes it, and then it appears again.

There are two places where color conversions are mentioned, first:
and second this bitmap->video mem conversion:

Re: AGS engine Mac OS X port
« Reply #171 on: 08 May 2020, 19:22 »
• macOS Catalina only (a macOS Mojave build would be nice, I'll see if I can get that working)
• Some of the colors in the game were inverted.  Not sure if it is the game, the engine, or some combo.  I'll need to do some research.

Could you try it with the CMake build instead, the colour issues were already meant to be fixed.

The build instructions are one page back on this same topic:
Or you can download a binary from here:

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: AGS engine Mac OS X port
« Reply #172 on: 18 May 2020, 09:57 »
I'm still interested in the MacOS executable though, even with the colors issue  :=
I can act as a tester if you guys wish.


Re: AGS engine Mac OS X port
« Reply #173 on: Yesterday at 03:11 »
I have no idea who wrote this but I found it very interesting: | backup

Spoiler: ShowHide

Porting Adventure Game Studio Games to the Mac
18th April 2020 | Games

During the 1980s, there was a plethora of competing computer systems
(Atari, Apple \]\[, DOS, Macintosh, Amiga, etc.), which was instrumental
in encouraging Sierra On-Line to develop their AGI and SCI game engines
to support many of these systems. Since those game engines were
interpreters, it was the game engine which needed to be ported, but the
resources and code could remain fairly consistent, which reduced the
effort to bring the games to multiple platforms.

After things shuffled out and settled down to two or three platforms
during the 1990s, most games came out for DOS/Windows. Only a handful of
games were ported to the Mac, and even if they were, it was often years
later. In an effort to come up with a more platform neutral solution, I
developed for my Master's Thesis the [Platform Independent Game
Engine]( which was based off
of cross-platform frameworks like C++, OpenGL, and OpenAL. This was more
of a proof of concept than a full fledged tool for game development.

Several months ago, Steven Alexander of Infamous Quests fame directed me to a
way that shows how games created with the Adventure Game
Studio  can be ported to the Mac with minimal effort. (Note: Minimal to the level that it doesn't involve
having to rewrite 80% of the code to support another platform.) The
process to take the resources from the Windows version of an AGS game
and turn it into a Mac application only takes a couple of minutes and
does not require fragile third party frameworks like Wine. However, the
process does not end there after copying a couple of files.

This article will detail several areas to help add the extra polish to
make your game port feel like a proper Mac app by designing an
appropriate app icon, configuring the Info.plist, and finally code
signing and notarizing the app for security. I'll demonstrate porting
the hypothetical game Knight's Quest (where you play the intrepid
adventure Sir Club Cracker and roam the countryside picking up anything
which hasn't been nailed down) and how to add the extra polish to make
it into a "proper" Mac application.

The aforementioned link to the Adventure Game Studio Forum post details
one method how to set up AGS to create a Mac version of a game.
Fortunately, there is already a gameless AGS shell application which can
be modified for your game to work on the Mac without having to go
through a number of convoluted steps to retrofit the Adventure Game
Studio to work on the Mac to develop an application.
the pre-compiled shell Mac application which is built for version 3.4.4
of AGS. This is an empty app, but we will soon populate it with the
required game assets. Mac apps are bundles, essentially a folder with a
collection of additional folders and files contained within. To port an
existing Windows AGS game, we will need to move a couple of the Windows
assets into the appropriate locations in the Mac app.

Right-click on the file [code single][/code] and select Show Package Contents
from the context menu. This will reveal the barebones contents of the
app. Inside the Contents folder is an Info.plist, a MacOS folder (which
contains the AGS executable), PkgInfo, and an empty Resources folder.

Take the executable file (.exe) of your Windows game (*not* the
winsetup.exe file that comes with some AGS games) and rename it to
[code single]ac2game.dat[/code]. If you run the [code single]file[/code] command against the [code single]ac2game.dat[/code]
file, you will see it is still a Windows executable file.

    $ file ac2game.dat
    ac2game.dat: PE32 executable (GUI) Intel 80386, for MS Windows

Next, copy the ac2game.dat, acsetup.cfg, audio.vox, music.vox,
speech.vox, and any other support files (such as files ending in .dll,
.tra, .000, .001, etc.) to the Resources folder. Your project may not
have all of these files, but most projects will contain at least
ac2game.dat, acsetup.cfg, and audio.vox.

Next rename the app bundle from AGS to the name of your game.

...and now the port is done\! Really. That wasn't so difficult, was it?
Except, it's not quite a polished Mac app, yet. To have the proper
look and feel of a proper Mac app, we still need to add that extra

One of the first things you'll notice about an app is its icon. Like so
many things in life, it's important to make a good first impression. The
same applies here. Right now, the app has a generic looking icon. For so
many years, icons were limited to small, pixelated blobs, but modern Mac
icons come in a wide range of resolutions from a tiny 16x16 to a
glorious 1024x1024.

If you have an older Mac on hand, use Icon Composer (one of the many
utilities which comes along with Xcode), otherwise, use an app like
Icon Slate to create a Mac
icon file (icns).

If you are starting with this barebones AGS app, the next section will
not apply, but this situation did come up with one app I helped port to
the Mac where the app's icon was set using an old fashioned resource
fork, a throwback of the Classic Mac OS days. If you need to check if
there is a icon resource fork present, go to the Terminal and [code single]cd[/code] into
the app bundle, then list the files contained. If you see a file that
says [code single]Icon?[/code], then there is a resource fork hidden within to represent
the app's icon.

Code: [Select]
    % cd
    $ ls -la
    total 2568
    drwxr-xr-x@  4 chadarmstrong  staff  128 Jan  1 14:15 .
    drwxr-xr-x  11 chadarmstrong  staff  352 Jan  1 20:33 ..
    drwxr-xr-x@  6 chadarmstrong  staff  192 Jan  1 14:15 Contents
    -rw-r--r--@  1 chadarmstrong  staff    0 Nov 26 08:26 Icon?

To remove the resource fork, either delete [code single]Icon?[/code] from the command
line, or if you prefer a more visual method, right-click on the app and
select the Get Info menu. In the Get Info window, click on the app icon
in the top left of the window, then hit the Delete key on your keyboard.

Other resource forks might still be lurking within the app, but we will
take care of those later.

Place the app icon file into the Resources folder of the app bundle.
Next, we will modify the Info.plist to add the app icon and other
important details.

The skeleton AGS app contains an Info.plist, which can be opened up in
any text editor or Xcode. A couple of additions, modifications, and a
deletion are necessary to properly customize for your game.

  - Update the bundle identifier (CFBundleIdentifier) to be unique to
    your game (e.g. com.companyname.productname)
  - Update the Bundle name (CFBundleName) and Display name
    (CFBundleDisplayName) with your game's name. The CFBundleExecutable
    should remain as AGS
  - Update the version (CFBundleShortVersionString) and build number
  - Add the human-readable copyright (NSHumanReadableCopyright)
  - Add name of the app icon (CFBundleIconFile)
  - Remove the [code single]UIStatusBarHidden[/code] key since this is for iOS and
    probably not necessary for a Mac port unless there is ever an iOS
  - Add the category type: [code single]LSApplicationCategoryType[/code]. Since this is
    the Adventure Game Studio, let's assume that many games being
    made with this IDE will be adventure games, so the
    [code single]LSApplicationCategoryType[/code] should be set to
    [code single][/code].
  - The Info.plist in the skeleton AGS app bundle contains a bunch of
    other odd cruft (such as DTSDKBuild) which probably can be removed,
    but I leave it in for now since it doesn't seem to hurt anything.

Following is a subset of the Info.plist file with the necessary changes.
Code: XML
  1.     <?xml version="1.0" encoding="UTF-8"?>
  2.     <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
  3.     <plist version="1.0">
  4.     <dict>
  5.         .
  6.         .
  7.         .
  8.         <key>CFBundleDisplayName</key>
  9.         <string>Knight's Quest</string>
  10.         <key>CFBundleName</key>
  11.         <string>Knight's Quest</string>
  12.         <key>CFBundleIdentifier</key>
  13.         <string>com.edenwaith.kq</string>
  14.         <key>CFBundleShortVersionString</key>
  15.         <string>1.0</string>
  16.         <key>CFBundleVersion</key>
  17.         <string>1</string>
  18.         <key>LSApplicationCategoryType</key>
  19.         <string></string>
  20.         <key>NSHumanReadableCopyright</key>
  21.         <string>Copyright © 2020 Edenwaith. All Rights Reserved</string>
  22.         <key>CFBundleIconFile</key>
  23.         <string>KQ-Icon</string>
  24.         .
  25.         .
  26.         .
  27.     </dict>
  28.     </plist>

Now when you launch the app, the new app icon will appear in the Dock.

Code Signing
Code signing is one of those things which has given me several new grey
hairs over the years. If code signing wasn't enough, Apple has now added
yet another layer of security with app notarization. Notarizing an app
does require several additional steps, but it has fortunately proven to
have not been too harrowing of an experience to figure out and
implement. If you are going to make an app for macOS Mojave, Catalina,
or later, it is a good idea to both code sign and notarize the app so
macOS will not pester the player with annoying warnings about the
validity and security of the app.

I have written
about about code signing
before, so this is not a brand new topic, but with the introduction of
notarization, there is some new information to share.

With the introduction of Xcode 11, there are new types of development
and distribution certificates (e.g. Apple Development, Apple
Distribution), but for this example, I use the older style Developer ID
Application certificate for signing the app for distribution.

Let's start by verifying that the app is not code signed:

    $ codesign --verify --verbose=4 Knight\'s\
    Knight's code object is not signed at all
    In architecture: x86_64
    $ spctl --verbose=4 --assess --type execute Knight\'s\
    Knight's rejected
    source=no usable signature

This looks as expected. The next step is to code sign the app bundle. In
the past, we would use a command like the following:

  1.  codesign --force --sign "Developer ID Application: John Doe (12AB34567D)"

However, with the introduction of notarization, there is a new set of
options to add to further harden the code signing process: `--options

Code: [Select]
codesign --force -v --sign "Developer ID Application: John Doe (12AB34567D)" --options runtime Knight\'s\
If everything works as hoped, you will see a successful message like

Code: [Select]
Knight's signed app bundle with Mach-O thin (x86_64) [com.edenwaith.kq]
If the code signing was successful, skip to the next section about

Unfortunately, it is far too easy for things to go wrong. With some apps
I've helped port, there would be resource forks or other Finder info
hidden somewhere in the app, so I'd see an error message like this one:

Code: [Select] resource fork, Finder information, or similar detritus not allowed
This error is due to a security hardening change that was introduced
with iOS 10, macOS Sierra, watchOS 3, and tvOS 10. According to Apple:

 Code signing no longer allows any file in an app bundle to have an
 extended attribute containing a resource fork or Finder info.

The first time I saw this error, I determined that the "offending" file
was the icon file, so I used the following command:

Code: [Select]
find . -type f -name '*.icns' -exec xattr -c {} \;
In one case, the problem was because I had added a Finder tag on the app
bundle. Removing the tag fixed the problem. With another instance, some
other file was causing issues, but I was not able to immediately
discover which was the suspect file.

To ferret out the problem, I used the [code single]xattr[/code] command to see what
extended attributes were available in the app bundle.
Code: [Select]
    $ xattr -lr Knight\'s\
    Knight's 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's 01c1;5e2e7a68;Firefox;7587AE66-F597-423C-8787-1DAE23ECA136
    Knight's 01c1;5e2e7a68;Firefox;7587AE66-F597-423C-8787-1DAE23ECA136
    Knight's 01c1;5e2e7a68;Firefox;7587AE66-F597-423C-8787-1DAE23ECA136
    Knight's 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    00000000  CD 72 0D 5E 00 00 00 00 B4 1E 64 2C 00 00 00 00  |.r.^......d,....|
    Knight's 0181;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's 0181;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C

To clean up the extraneous resource forks (and other detritus), use the

Code: [Select]
xattr -cr Knight\'s\
Once the cruft has been removed, verify with [code single]xattr -lr[/code] again and then
try code signing the app once more. Perform one more set of
verifications to ensure that things look good.

Code: [Select]
    $ codesign --verify --verbose=4 Knight\'s\
    Knight's valid on disk
    Knight's satisfies its Designated Requirement
    $ spctl --verbose=4 --assess --type execute Knight\'s\
    Knight's accepted
    source=Developer ID

Now on to the new stuff\! The first thing you'll need to do is generate
an app-specific password for
this app. Log in to [Manage Your Apple ID
page](!&page=signin) with your Apple
developer credentials. Under the Security section, tap on the **Generate
Password...** link. In the pop up, enter in a description for the app
(e.g. Knight's Quest), and then an app-specific password will be
generated. The app-specific password will be a sixteen character
password that will look similar to this: [code single]wcag-omwd-xzxc-jcaw[/code] . Save
this password in a secure place\! You will need this password for
notarizing the app.

The next step will involve packaging the app to be notarized. It can be
packaged as either a zip archive (zip), disk image (dmg), or an
installer package (pkg). Since this is just a single app bundle, a zip
file will work.

Code: [Select]
    // Zip up the app
    ditto -c -k --sequesterRsrc --keepParent *app

For the next step, if your Apple ID is only part of a single developer
account, you can skip ahead. However, if your Apple ID is associated
with multiple accounts (such as multiple companies), then you will need
to obtain more specific information before notarizing the app.
Otherwise, if you try to notarize an app and your Apple ID belongs to
multiple accounts, you will see this error:

 `Error:: altool[7230:1692365] *** Error: Your Apple ID account is
 attached to other iTunes providers. You will need to specify which
 provider you intend to submit content to by using the -itc_provider
 command. Please contact us if you have questions or need help. (1627)`

To get the list of providers linked to your Apple ID, use this command:

Code: [Select]
xcrun iTMSTransporter -m provider -u -p wcag-omwd-xzxc-jcaw
This command will output a bunch of cruft, but ends with:

Code: [Select]
    Provider listing:
       - Long Name -     - Short Name -
    1  John Doe            JohnDoe18675309
    2  Acme, Co.       AcmeCo

In this hypothetical example, the developer John Doe has his own
personal Apple developer account and also belongs to Acme's developer
account, as well. For this project, John will use his personal account,
so he will use the short name of [code single]JohnDoe18675309[/code], which will be used
as the ASC provider value in the following command. Again, you can omit
the [code single]asc-provider[/code] option for the notarization call if your credentials
are associated with only a single team.

To notarize the app, you will use the application launcher tool
([code single]altool[/code]), which can also be used for other purposes (such as
uploading the app to
Apple's servers). The format of notarizing is as follows:

Code: [Select]
xcrun altool --notarize-app --primary-bundle-id com.example.appname --username APPLE_DEV_EMAIL --password APP_SPECIFIC_PASSWORD --asc-provider PROVIDER_SHORT_NAME  --file
For our example, we filled in the blanks with the following values:

  - primary-bundle-id : com.edenwaith.kq
  - APP\_SPECIFIC\_PASSWORD : wcag-omwd-xzxc-jcaw
  - asc-provider : JohnDoe18675309
  - :

Code: [Select]
xcrun altool --notarize-app --primary-bundle-id "com.edenwaith.kq" -u -p wcag-omwd-xzxc-jcaw --asc-provider JohnDoe18675309 --file
For a more in depth break out of what each of these options mean, refer
to Davide Barranca's [excellent
on this topic.

This process can take awhile, depending on how large your file is, since
it needs to get uploaded to Apple's servers and be notarized.
Unfortunately, this potentially long wait time comes with consequences
if there is an error. One reason notarization might fail is if you need
to accept Apple's terms of agreement (which may have also been updated),
so you might see an error like:

Code: [Select]
     /var/folders/pv/xtfd6hjn7hd8kpt70q0vwl8w0000gq/T/15A31C27-F6AF-48E8-9116-A30A7C76AD03/com.edenwaith.kq.itmsp - Error Messages:
             You must first sign the relevant contracts online. (1048)
     2020-04-11 11:23:19.745 altool[22640:1119844] *** Error: You must first sign the relevant contracts online. (1048)

One approach to fix this is to log in to the Apple developer portal and
check to see if new terms of service need to be reviewed. If so, agree
to the terms, and wait a couple of minutes before trying to notarize
again. You can also check Xcode's license agreement from the Terminal by
typing in the command:

Code: [Select]
sudo xcodebuild -license
However, if everything works properly with uploading the file, you will
get a message like this:

Code: [Select]
    No errors uploading ''.
    RequestUUID = 2de2e2f9-242f-3c78-9937-1a7ef60f3007

You'll want that RequestUUID value so you can check on the notarization
status to see if the package has been approved yet. After uploading your
app, the notarization process typically takes anywhere from several
minutes to an hour. When the process completes, you receive an email
indicating the outcome. Additionally, you can use the following command
to check the status of the notarization process:

Code: [Select]
    $ xcrun altool --notarization-info 2de2e2f9-242f-3c78-9937-1a7ef60f3007 -u -p wcag-omwd-xzxc-jcaw
    No errors getting notarization info.
              Date: 2020-01-04 22:44:42 +0000
              Hash: adf86725dec3ab7c26be17178e07efaf3b2806f743fefd0dd1059f68dcf45398
       RequestUUID: 2de2e2f9-242f-3c78-9937-1a7ef60f3007
            Status: success
       Status Code: 0
    Status Message: Package Approved

Once the package has been approved, we can move on to the stapling the
ticket to the app.

At this point, the app has been validated and notarized, so if an app
launches, macOS will check with the servers and verify that the app has
been properly notarized. However, if the computer is not online, then it
cannot perform this step, so it is useful to staple the ticket to the
app for offline usage.
Code: [Select]
    xcrun stapler staple -v
Once again, a ton of text will scroll across the Terminal. If it works,
the last line should read: [code single]"The staple and validate action worked!"[/code]

For sanity's sake, validate that stapling worked:

Code: [Select]
    stapler validate Knight\'s\
    Process: Knight's
    The validate action worked!

However, if the stapling hasn't been completed, there will be an error
like this:

Code: [Select]
    $ stapler validate Knight\'s\
    Processing: Knight's
    Knight's does not have a ticket stapled to it.

For a final verification, use [code single]spctl[/code] to verify that the app has been
properly signed and notarized:

Code: [Select]
    $ spctl -a -v Knight\'s\
    Knight's accepted
    source=Notarized Developer ID

Notice that this check varies slightly from when we first did this check
before the notarization — the source now says [code single]Notarized Developer ID[/code].

[h3]Final Packaging[/h3]
Now that the game has been ported, code signed, and notarized, it is
time to package it up for distribution. There are a variety of ways to
do so, whether via an installer, a disk image, or a zip archive. If you
are distributing the game via download from your website, you'll
probably want to bundle the game and any other extras (such as README
files, game manuals, etc.) into a single containing folder. If you are
going to upload the game to Steam, then you may not want an enclosing

To be a good internet citizen, make sure when the zip archive is
created, that any Mac-specific files are removed, such as the .DS\_Store
file and \_\_MACOSX, which stores excess metadata and resource forks.

Code: [Select]
zip -r . -x ".*" -x "__MACOSX"
This example zips up everything in the current directory, but excludes
any dot files and any unwanted metadata. With the game packaged up, it's
ready to go\!

[h3]Ported Games[/h3]
It has been a pleasure and joy to help bring a number of adventure games
to the Mac. Below is the list of AGS games I've helped port. I highly
recommend that if you enjoy adventure games, give them a try\! I hope
that this extensive tutorial has been useful in learning how to port
games developed with the Adventure Game Studio to the Mac, in addition
to learning how to code sign and notarize a Mac application. If you
would like assistance in porting, contact me via
e-mail or

  - Space Quest 2 VGA
    by Infamous Adventures
  - King's Quest 3 VGA
    by Infamous Adventures
  - Order of the Thorne - The King's Challenge by
    Infamous Quests
  - Quest for Infamy
    by Infamous Quests
  - Feria D'Arles by Tom
  - The Crimson Diamond by Julia
  - Stair Quest by No More For
    Today Productions

  - Adventure Game Studio
  - AGS engine Mac OS X port
  - Notarizing macOS Software Before Distribution
  - Customizing The Notarization Workflow
  - Your Apps and the Future of macOS Security
  - Apple ID - Create Per App-Specific Passwords
  - Using app-specific  passwords
  - How to Notarize Your Software on macOS
  - App Notarization: A Quick Primer
  - Apple Ramps Up Fight against Malware with Notarization, Stapling, and Hardening
  - Replacing Application Loader with altool
  - Notarization Provider IDs
  - Selecting iTunes Provider for Notarization
  - Technical Q\&A QA1940 Code signing fails with error 'resource fork, Finder information, or similar detritus not allowed'
  - Signing and Notarizing macOS Apps for Gatekeeper
  - Codesigning and notarizing your LC standalone for distribution outside the Mac Appstore
  - Signing and Notarizing for Catalina
  - Dev Journal — Automate notarizing macOS apps
  - Mac zip compress without \_\_MACOSX folder?
  - Compress without .DS\_Store and \_\_MACOSX
  - Notarizing installers for macOS Catalina
  - Notarize a Command Line Tool
  - Building and delivering command tools for Catalina

© 2001 - 2020 Edenwaith -

« Last Edit: Yesterday at 04:33 by eri0o »

Privateer Puddin'

  • Mittens Viscount
  • bob
    • Privateer Puddin' worked on one or more games that won an AGS Award!
    • Privateer Puddin' worked on one or more games that was nominated for an AGS Award!
Re: AGS engine Mac OS X port
« Reply #174 on: Yesterday at 04:38 »
Look up a few posts and see the author posting in this very thread


Re: AGS engine Mac OS X port
« Reply #175 on: Yesterday at 12:58 »
Ha! Thanks Privateer Puddin!  ;-D