Running Portal natively on Apple Silicon
Portal, a puzzle-platform game developed by Valve, was first released in 2007 as part of The Orange Box. It quickly became a cult classic, known for its unique mechanics and dark humor. Set in a mysterious research facility, the game revolves around the use of a "portal gun" to create linked portals that allow the player to navigate through the environment and solve puzzles. It’s widely regarded as one of the best games of the 2000s and remains a staple of gaming culture.
In recent years, Portal became available on multiple platforms, including macOS. However, with the increasing focus on 64-bit computing, Valve's macOS version of Portal remained stuck in the 32-bit era, making it incompatible with the latest macOS updates. In 2020, Apple announced that macOS Catalina (10.15) and beyond would no longer support 32-bit applications, forcing many older games and software to be abandoned or require updates to work on newer systems.
For those looking to play Portal on macOS today, there is a workaround: using the leaked Source Engine code to build the game from scratch. The source code was made public years ago, and while it has some issues out of the box, with a bit of tinkering, it can be compiled to work on modern macOS versions.
In this post, I'll walk you through the steps to build Portal on macOS using the leaked Source Engine, specifically for users who are dealing with Apple’s 64-bit-only policy. The process involves downloading the leaked source code, building the engine, downloading the necessary game assets, and combining everything to make Portal run on your system.
Step 1: Download the Leaked Source Code
The leaked source code for the Source Engine is available on GitHub. However, you'll want to use a specific fork for it to build successfully on macOS.
- Main repository: nillerusr/source-engine
- Unfortunately, this repository doesn’t build successfully on macOS by default
- Working fork: er2off/source-engine
- This commit fixes the build issues
Step 2: Build the Source Code
Once you've downloaded the source, follow these instructions to build it.
Prerequisites
Install the required dependencies:
xcode-select --install brew install sdl2 freetype2 fontconfig pkg-config opus libpng libedit jpeg jpeg-turbo python3
Next, set up your workspace:
cd ~/workspace git clone --recursive https://github.com/er2off/source-engine.git cd source-engine git checkout clang19
Build the Engine
Now you can configure and build the source:
python3 waf configure -T release --prefix='' --build-games=portal python3 waf build python3 waf install --destdir='~/Documents/Gaming/Portal'
Step 3: Download Game Assets from Steam
Portal for macOS is still available on Steam today, but only as 32-bit version. This means you can download it, but you cannot run in. Our goal is to combine the assets from this download with our own 64-bit game engine build. Unfortunately, recent updates to the game have made it incompatible with the leaked source engine. The last version of Portal from 2024 that works with the leaked engine can be found on SteamDB:
Luckily, the current beta branch "SteamPipe Beta" points to this older version, so it is very easy to download from Steam.
Step 4: Combine the Engine and Assets
Now that you’ve built the engine and downloaded the necessary game files, it’s time to combine them. First we back up Steam's Portal folder, then delete the 32-bit binaries, and finally replace them with our own 64-bit versions.
cd ~/Library/Application\ Support/Steam/steamapps/common/Portal cp -r . ~/Portal_backup rm -rf ./bin ./portal/bin ./hl2_osx cp -r ~/Documents/Gaming/Portal/bin ./bin cp -r ~/Documents/Gaming/Portal/portal/bin ./portal/bin cp ~/Documents/Gaming/Portal/hl2_launcher ./hl2_osx
Note how hl2_launcher
gets renamed to hl2_osx
.
Step 5: Run the Game
Finally, you're ready to run the game!
./hl2_osx -game Portal
This should launch the game using the custom-built engine. In my experiments it runs flawlessly.
The launch button in Steam should now work as well.
What about Portal 2?
While this approach works for the original Portal (and Half Life 2), it does not work for Portal 2. Portal 2 requires a more recent version of the Source Engine, so it is not compatible with the leaked code we used. If you're looking to play Portal 2 or need a more straightforward way to play Portal on newer versions of macOS, there are several alternatives you can explore using emulation. I have not tried these myself, but googling for terms such as Wine, Whisky, Crossover and Proton should get you started.
Happy gaming!
PS: in retrospect it might be safer to combine the engine and the assets in a folder outside of Steam, so that it will not accidentally get overwritten by any incoming updates.