How to use the Game Porting Toolkit on macOS Sonoma

Game Porting Toolkit

The launch of the Apple Game Porting Toolkit at WWDC gave developers a chance to see how Windows games work on Apple Silicon before porting them to macOS.Here’s how to install and use the toolbox.

At WWDC ’23, Apple released the Game Porting Toolkit (GPTK), essentially a repackaged version of the WINE API translation technology that allows you to run Windows games on Apple Silicon Mac computers.

WINE runs on the Mac by mapping Windows native DirectX and other API calls to the Apple Metal graphics engine and standard POSIX APIs that are part of UNIX.

By providing direct connection and conversion to naive APIs on Mac, WINE allows Windows games to run at natural speed.Because Metal is optimized to run efficiently on Apple Silicon Mac computers, it allows Windows games to run at nearly native speed.

WINE is not an emulator – it provides a direct mapping from Windows to the native API on the Mac.

Similar to the Steam Proton porting tool, GPTK allows you to install and run most, but not all, Windows games on your Apple Silicon Mac.WINE is still under development so expect more compatibility in the future.

However, keep in mind that the GPTK setup process is a bit complicated and requires terminal skills.Installation also takes over an hour, as many software components must be downloaded and built from source.

The GPTK Read Me has some pretty good instructions, and several gaming bloggers have posted even more detailed instructions online.We will try to simplify these instructions here.

Installing macOS Sonoma and GPTK

To install GPTK you will need:

Apple Silicon Mac Apple Developer Account macOS Sonoma beta 3 or later Xcode 15 beta Xcode 15 beta Command Line Tools Intel x86 version of Homebrew Package Manager Apple Rosetta 2 emulator for Apple Silicon Macs Game Porting Toolkit .dmg download

To get the above components, first sign in to your Apple Developer account using your Apple ID, then go to https://developer.apple.com/download/ and download macOS 14 Beta 3.

After downloading the macOS beta, get the developer components from https://developer.apple.com/download/all/.

You will need to download Xcode 15 beta 4, Command Line Tools for Xcode 15 beta 4 and Game Porting Toolkit beta 1.0.2.

You’ll also want to set up an external storage device first and install the beta version of macOS Sonoma on it.Then set it as a boot disk in system settings, restart that volume, and install Xcode and GPTK beta from there.

Note that the Sonoma beta must be installed on an existing macOS Ventura installation.You’ll want to wipe the external storage device as APFS using Apple’s Disk Utility and put a fresh install of macOS Ventura on it first.

Be aware that this will erase everything on any external storage device that you erase in Disk Utility.You should probably back up all important data from your Mac first.

You can download the macOS Ventura installer from the Mac App Store.

After that, go to “System Preferences” from the Apple menu, then select “General” -> “Startup Disk” from the sidebar on the left.

After a few seconds, System Preferences will display all the volumes your Mac can boot from.Select the one you just installed Ventura on.

In the example below, we have created a volume named “Test” on an external USB drive:

Set the new external volume as the boot drive.

Set the new external volume as the boot drive.

Click the Reload button.

Once your Mac boots up with a fresh install of Ventura, run any software updates to make sure everything is up to date.

To install the macOS Sonoma beta, go back to Apple->System Preferences->General, but this time select Software Update from the General list.

Next to the “Beta updates” line, click the small information button:

Click the Information button.

Click the Information button.

If the Beta Updates toggle is set to Off, click the small pop-up menu and select macOS Sonoma Public Beta from the pop-up menu.Click “Finish” and you will be returned to the “Software Update” panel:

Select

Select “Sonoma beta” from the pop-up menu.

A new panel for the Sonoma beta will appear along with an Update Now button on the right.Click Update Now to start downloading the macOS beta:

Click

Click Update Now.

Once the beta installation is complete, your Mac should restart, and if not, reboot.After booting into macOS Sonoma, you need to install the Homebrew package manager.

If for some reason the beta update does not install, you can also install it manually using the UniversalMac_14.0_23A5286i_Restore.ipsw file downloaded from the Apple website.

Next, unzip the Xcode_15_beta_4.xip file (.xip is just a signed .zip file) and the Xcode .dmg command line tools that contain the installer.

First, copy the Xcode 15 beta to your Applications folder, double-click it in the Finder to launch it, and if prompted, install any additional tools it asks for.

Then open the Xcode Command Line Tools .dmg file downloaded from the Apple website and double click Command Line Tools.pkg.Follow the installation instructions in the installer to install the tools.

GPTK installation

Then double click the Game_porting_toolkit_beta_1.02.dmg file downloaded from the Apple site.This disk image contains three command-line tools, Read Me, and a lib folder containing the D3DMetal.framework package, the libd3dshared.dylib dynamic library, and the Windows to POSIX WINE bridge libraries that enable code translation for Windows games..

The command line and Homebrew tools will be used to install the porting tool libraries.But first, you must set up Homebrew and the Apple Rosetta 2 emulator to work together properly.

There are currently two versions of the Homebrew binary, one for Apple Silicon (ARM) Macs and one for Intel (x86) Macs.We’ll come back to this in a moment.

After installing the Apple Rosetta 2 emulator, you can launch an x86-only shell window in the Terminal application so that commands entered into it will launch only x86 versions through Rosetta.This is required to run the commands and tools needed to configure GPTK.

There are complete setup steps in the attached Read Me file, but we’ll cover them briefly here.

Make sure Rosetta is installed

To install the Rosetta emulator on your Mac, open a terminal window and type:

softwareupdate – install-rosetta and press Return.You may be prompted to enter an administrator password.

After that, enter x86 mode in the Terminal by typing:

arch -x86_64 zsh and pressing Return.

Then install the x86_64 version of Homebrew in the Terminal:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

You may again be prompted for an administrator password to complete the installation.

After that, check the installation of Homebrew in the Terminal:

which brew and press Return.

If the result is not /usr/local/bin/brew, you need to change your PATH variable to put /usr/local/bin first, which tells macOS where to look for the tools.

The PATH environment variable can be changed at login using one of a variety of configuration files: a .bashrc or .zshrc file in the user’s home folder, or a profile file in the etc folder at the root of the boot drive.

Then tap the Apple Homebrew tap in the Terminal:

brew tap apple/apple http://github.com/apple/homebrew-apple

Now install GPTK

brew -v install apple/apple/game-porting-toolkit

This can take a while, up to an hour depending on the speed of your Mac, as it will download and compile several programs as it runs.

The GPTK Read Me mentions a note about possible errors at this stage:

“If you see an error during installation, such as “Error: game-porting-toolkit: unknown or unsupported version of macOS: :dunno”, your version of Homebrew does not support macOS Sonoma.Update to the latest version of Homebrew and try again.”

brew -v install apple/apple/game-porting-toolkit

Setting WINE prefixes

In WINE, you can set up the C: virtual drive just like in Windows.In WINE terminology, this is called a prefix.

For GPTK, you will install the toolkit and any games you want to run with the same prefix.From “Read Me”:

“Run the following command to create a new Wine prefix named my-game-prefix in your home directory.”

WINEPREFIX=~/my-game-prefix `brew – prefix game-porting-toolkit`/bin/wine64 winecfg

“The Wine Configuration window should appear on your screen.

Change Windows version to Windows 10.

Select “Apply” and then “OK” to exit winecfg.

If the Wine Configuration window does not appear and the new icon does not appear in the Dock, make sure you have correctly installed the x86_64 version of Homebrew and the game porting toolkit formula.”

Set GPTK to WINE prefix

In this step, you must ensure that the Game Porting Toolkit-1.0.2 .dmg file is still mounted on your desktop.If not, double click it again to mount it.

The bridge libraries mentioned above should be installed to the WINE prefix you created above.To do this, in the Terminal, enter:

ditto /Volumes/Game Porting Toolkit-1.0/lib/ `brew – prefix game-porting-toolkit`/lib/

ditto is a macOS command-line tool that knows how to copy files and folders on a Mac with perfect accuracy – copying any resource branches, permissions, ownership, groups, and access control lists to the target files.

There is also a detailed mode for the same.See the man page of the same in Terminal for more information.

The above line copies the intermediate libraries from the mounted .dmg game porting toolkit to the WINE prefix you created above.

Install Windows Games

Now that the WINE and GPTK prefix is ​​set up, you can copy any Windows games to the prefix (C: drive) using the open UNIX command and copying your game to the prefix in Finder.For example:

open ~/my-game-prefix/drive_c

This will open the C: drive in a new Finder window where you can copy the Windows game binaries.Drive C: works just like any other volume on your Mac’s desktop.

Launch a Windows game in WINE

You are finally ready to launch your game with WINE.

To do this, you specify the gameportingtoolkit command on the command line, then the WINE prefix path, the drive letter (in this case, C:), and then the full path to the game binary file that you copied above.For example:

gameportingtoolkit ~/my-game-prefix ‘C:Program FilesMyGameMyGame.exe’

launches a game called MyGame in ProgramFIlesMyGame on the WINE C: drive.

By default, your game starts with the Metal Heads Up Display, but you can disable the HUD by using the gameportingtoolkit-no-hud command instead:

gameportingtoolkit-no-hud ~/my-game-prefix ‘C:Program FilesMyGameMyGame.exe’

The Read Me details other options, such as disabling ESYNC for better game compatibility.

Apple’s GPTK is an exciting new addition to Mac gaming, and as it evolves and improves, it promises to bring many Windows games to Mac running at near-native speed.This means that every Apple Silicon Mac is suddenly open to the whole world of Windows gaming.

It also means that after the enhancement, game developers won’t need to port their games to Mac, making most Windows games playable on Mac from day one.