Claude Code ports Half-Life 2 natively to Mac and iPhone in under two days
A developer used Claude Code to translate Half-Life 2 and its episodes so the game runs natively on Apple Silicon Macs and even on the iPhone. He says it took less than two days to go from the first commit to a playable iPhone build. The trick is a custom recompiler that had already brought Portal 2 to the Mac.

What it's about
On the r/ClaudeAI subreddit, a developer showed how he got Valve's classic shooter Half-Life 2 running natively on Apple Silicon Macs and even on the iPhone. The expansions Episode One and Episode Two and the tech demo Lost Coast are included too. The twist: by his account, he didn't write most of the code himself. That was Claude Code, Anthropic's AI coding assistant that works directly in the terminal, running mostly on the Opus 5.5 model. The developer did the testing and made the decisions.
It's not his first project of this kind. He had already used the same method to bring Portal 2 to Apple Silicon. The project is public on GitHub: github.com/kanapitsas/source-recomp.
How it works: static recompilation
There's no official native version of Half-Life 2 for current Macs with ARM processors. The usual route would be emulation, where a program imitates a foreign processor and translates its instructions while you play, which costs performance. This project takes a different approach: static recompilation. A program's finished machine code is translated into another form ahead of time instead of at runtime. Think of translating a whole book once instead of interpreting it sentence by sentence while you read it aloud.
In practice, the recompiler takes the x86 code of the game's Linux version (x86 is the processor architecture of classic Intel and AMD PCs), translates it into C, and then compiles that C code for ARM64, the architecture of Apple's chips in Macs and iPhones. What comes out is a program that runs directly on Apple hardware.
The developer notes that a native port existed a few years ago, but it was based on leaked source code. His approach doesn't need Valve's source code. It only works with the program files you already own as a buyer.
Two days from first commit to iPhone
The recompiler had already been built for Portal 2, and both games run on Valve's Source engine. So according to the developer, it got the project "most of the way there." He describes the rest as a two-day sprint:
- Day 1: Claude added game-specific profiles, support for SSSE3 instructions (an x86 instruction set extension for fast math that had to be reimplemented), Linux function calls Half-Life 2 needed that were missing, and a bridge to the game's newer Steam SDK. By evening the game was playable, but without texture filtering, so surfaces looked pixelated. The reason: OpenGL on macOS doesn't support sampler objects, which modern graphics APIs use to control how textures are smoothed. Claude fixed that and then got Half-Life 2 running on Metal, Apple's own graphics API. To do so, it used a bridge from Direct3D 9 (Microsoft's older graphics API, which the game was originally built for) to Metal that had already been created for Portal 2.
- Day 2: Performance optimization, Metal as the default, and finally the iOS build with touch controls. He admits the touch controls could still use some work.
How to get the Mac version yourself
There's now an installer app. It finds your Steam games on your Mac and builds native versions from them. The developer says this takes about 10 to 20 minutes per game. You'll need:
- Apple's Xcode Command Line Tools (the developer tools for compiling),
- the games' Linux binaries, which you have to download through the Steam console,
- and of course the games themselves, purchased on Steam.
The project doesn't include any game files. The developer explicitly asks people not to share pre-built apps. It's unofficial and not affiliated with Valve.
Our take
The project is a vivid example of how far AI coding assistants have come with complex, low-level work. Static recompilation long belonged to a small group of specialists. Projects like the recompilation of Nintendo 64 games took months or years. Here, one person with AI help ported several Source engine games in a short time, solving problems like missing graphics features and translating between graphics APIs along the way.
There's an important caveat, though. The fast Half-Life 2 port builds on the groundwork done for Portal 2, so the under-two-days figure only covers the extra effort. All claims also come from the developer himself. There are no independent tests of stability or performance, and he admits the touch controls aren't finished yet. Legally, the project sits in a gray area, which it tries to keep as small as possible with its "only your own games, no sharing" rule. Still, if you're a Mac gamer who wants to play your Steam library without emulation or Windows, it's an exciting option.
Sources
- Reddit r/ClaudeAI reddit.com
Ask the AI assistant
Questions about this article, installation or background? Our assistant knows this page and runs on our own machine, not in someone else's cloud.
The Assistant is an AI (Gemma 4) and can make mistakes – please check important details against the source. Questions are used only to generate an answer and are deleted after one hour. Please don't enter any personal data.
Comments
What do you think? Already tried it? Write it here, no sign-up needed.
Comments are public. Links aren't allowed, and we delete abusive posts. You can delete your own comment at any time in this browser. Learn more in the Privacy Policy.