I ported Mac OS X to the Nintendo Wii (bryankeller.github.io)

by blkhp19 328 comments 1924 points
Read article View on HN

328 comments

[−] rayiner 37d ago
Not only is this an insanely cool project, the writeup is great. I was hooked the whole way through. I particularly love this part:

> At this point, the system was trying to find a framebuffer driver so that the Mac OS X GUI could be shown. As indicated in the logs, WindowServer was not happy - to fix this, I’d need to write my own framebuffer driver.

I'm surprised by how well abstracted MacOS is (was). The I/O Kit abstraction layers seemed to actually do what they said. A little kudos to the NeXT developers for that.

[−] blkhp19 37d ago
I felt similarly. The learning curve was a tad steep, especially since I had never written a driver before, but once I figured out how to structure things and saw the system come alive, I grew to appreciate the approach IOKit takes.

With that said, I haven't developed drivers for any other platforms, so I really can't say if the abstraction is good compared to what's used by modern systems.

[−] spijdar 37d ago
IOKit was actually built from the ground up for OS X! NeXT had a different driver model called DriverKit. I've never coded against either, but my understanding was they're pretty different beasts. (I could be wrong)

That said, indeed, the abstraction layer here is delightful! I know that some NetBSD devs managed to get PPC Darwin running under a Mach/IOKit compatibility layer back in the day, up to running Xquartz on NetBSD! With NetBSD translating IOKit calls. :-)

[−] twoodfin 37d ago
There’s a great video of a NeXT-era Steve Jobs keynote floating around—I think the one where he announces the x86 port as NeXT was transitioning to a software-only company—where he specifically calls out DriverKit and how great it is.

Steve was not a developer but he made it his business to care about what they cared about.

[−] nxobject 36d ago
Yeah - even from the start, I remember NeXT marketing was spending a disproportionate amount of their time selling NeXT’s “object technology”, AppKit and Interface Builder, DPS as an advanced graphics model. It was good hunch from Steve, given how how modern NeXTSTEP feels in retrospect.

For some reason, though, it means that people overlook how NeXT’s hardware was _very_ far from fast. You weren’t going to get SGI level oomph from m68k and MO disks.

[−] lukeh 36d ago
Yup, even with a hard drive the m68k turbo slab was no speed demon. Wasn't too bad on HPPA though.
[−] erichocean 37d ago
As I remember it, they were basically the same—but IOKit is C++ (with restrictions) because 3rd party developers didn't want to learn Objective-C.

But that's a hazy, 20 year old memory.

[−] spijdar 37d ago
Yes, you're right! I'm just dolt who's never checked what a .kext on OS X actually is.

I had been under the impression that DriverKit drivers were quite a different beast, but they're really not. Here's the layout of a NS ".config" bundle:

  ./CG6FrameBuffer.config/English.lproj
  ./CG6FrameBuffer.config/English.lproj/Info.rtf
  ./CG6FrameBuffer.config/English.lproj/Localizable.strings
  ./CG6FrameBuffer.config/CG6FrameBuffer_reloc
  ./CG6FrameBuffer.config/Default.table
  ./CG6FrameBuffer.config/Display.modes
  ./CG6FrameBuffer.config/CG6FrameBuffer
The driver itself is a Mach-O MH_OBJECT image, flagged with MH_NOUNDEFS. (except for the _reloc images, which are MH_PRELOAD. No clue how these two files relate/interact!)

Now, on OS X:

  ./AirPortAtheros40.kext/Contents
  ./AirPortAtheros40.kext/Contents/_CodeSignature
  ./AirPortAtheros40.kext/Contents/_CodeSignature/CodeResources
  ./AirPortAtheros40.kext/Contents/MacOS
  ./AirPortAtheros40.kext/Contents/MacOS/AirPortAtheros40
  ./AirPortAtheros40.kext/Contents/Info.plist
  ./AirPortAtheros40.kext/Contents/version.plist
OS X added a dedicated image type (MH_KEXT_BUNDLE) and they cleaned up a bit, standardized on plists instead of the "INI-esque" .table files, but yeah, basically the same.
[−] KerrAvon 35d ago
You're focusing on the executable format, which is very much not the driver model.
[−] steve1977 37d ago
From here:

https://news.ycombinator.com/item?id=10006411

"At some stage in the future we may be able to move IOKit over to a good programming language"

[−] xenadu02 37d ago
IOKit was almost done in Java; C++ was the engineering plan to stop that from happening.

Remember: there was a short window of time where everyone thought Java was the future and Java support was featured heavily in some of the early OS X announcements.

Also DriverKit's Objective-C model was not the same as userspace. As I recall the compiler resolved all message sends at compile time. It was much less dynamic.

[−] pjmlp 36d ago
Mostly because they thought Objective-C wasn't going to land well with the Object Pascal / C++ communities, given those were the languages on Mac OS previously.

To note that Android Things did indeed use Java for writing drivers, and on Android since Project Treble, and the new userspace driver model since Android 8, that drivers are a mix of C++, Rust and some Java, all talking via Android IPC with the kernel.

[−] lemoncucumber 36d ago

> there was a short window of time where everyone thought Java was the future

Makes me think of how plists in macOS are xml because back then xml was the future

[−] pjmlp 36d ago
Yes, also the same reason why Java was originally introduced, Apple was afraid that the developer community educated in Object Pascal / C++, wasn't keen into learning Objective-C.

When those fears proved not true, and devs were actually welcoming Objective-C, it was when they dropped Java and the whole Java/Objective-C runtime interop.

[−] steve1977 37d ago
Funnily enough, there is a (different) DriverKit in macOS again now ;)
[−] pjmlp 36d ago
Driver Kit used Objective-C, and ironically it is back, as Apple gave the same name to the userspace driver model replacement for IO Kit.
[−] geerlingguy 37d ago
And there are enough parallels to Linux's stack, I'm thinking about looking through the Linux on Wii project more and comparing how it handles fb issues in comparison. I loved reading this whole post, crazy how many OSes have now been run on the humble Wii!
[−] MarceliusK 36d ago
Once he could satisfy the expected interfaces well enough, the rest of the system seems to have been surprisingly willing to play along
[−] steve1977 37d ago
I guess having targeted multiple architectures and in the case of OPENSTEP also operating systems early on certainly helped.
[−] phendrenad2 37d ago

> I'm surprised by how well abstracted MacOS is (was).

Usually the difference between something being well-abstracted vs poorly-abstracted is how well it's explained.

[−] redbell 36d ago
Excellent project! This is one of the topics that keeps Hacker News ever refreshing. Seeing work get done in a way that feels like real hacking but in a positive way.

You might also be interested in this similar work: Installing Mac OS on the Nintendo Wii [video] (123pts, 37cmts): (https://news.ycombinator.com/item?id=37306018)

The author has mentioned earlier attempts to port other OSes to the Wii but it appears these works didn't get much traction here on HN except for Windows:

  WindowsNT (255pts, 86cmts): https://news.ycombinator.com/item?id=43221633
  Linux (53pts, 1cmts): https://news.ycombinator.com/item?id=30568676
  NetBSD (4pts,0 cmts): https://news.ycombinator.com/item?id=46668959

Lastly, since we are in the context of turning the Wii into a computer, I'd like to honorable mention: Hosting a blog on the Wii (622pts, 104cmts): (https://news.ycombinator.com/item?id=43754953)
[−] guyzero 37d ago
In addition to the incredible engineering work here the OP casually flexes by showing the development happening _in an economy class airplane seat_.
[−] soci 37d ago
Back in the day I was a hardcore Mac nerd and became a professional at it too. My best reverse-engineering trophy was building one of the first "iOS" apps when there was not an official appstore for the iPhone.

But man, this is way ahead of what I could do. What this dude accomplished blew my mind. Not only the output (running MacOS on a Wii), but the detailed post itself. A-MA-ZING.

[−] jmcneill 37d ago
As the author of the NetBSD Wii and Wii U ports, congrats! I’m looking forward to seeing how you solved some of the problems that I faced along the way.
[−] raincole 37d ago

> As for RAM, the Wii has a unique configuration: 88 MB total

TIL Wii has only 88MB of RAM. Fortunately games weren't electron-based.

[−] knivets 37d ago
Refreshing to read an article with an actual engineering work as opposed to another article about AI. Great work, very inspiring!
[−] devy 36d ago
This reminds me the 2008-2009 era where Mac OS X Leopard was running Hackintosh on Dell Mini 9 and some other netbooks.

At $349, it was almost a fully functional laptop that runs on Mac OS X (comparing to over $1000+ MacBooks or $1599 MacBook Pros)

Two friends of mine literally working remotely in an Africa trip with Dell Mini 9 and mobile hotspots and were doing video conferencing with Skype (on Wi-Fi).

[1] https://en.wikipedia.org/wiki/Dell_Inspiron_Mini_Series

[2] https://en.wikipedia.org/wiki/Hackintosh

[−] k38f 37d ago
Debugging kernel panics on a Wii in an economy seat is a level of focus I can't even imagine. Most people can't read a book on a plane without losing their place every 5 minutes.
[−] NetOpWibby 37d ago

  Before figuring out how to tackle this project, I needed to know whether it would even be possible. According to a 2021 Reddit comment:

    There is a zero percent chance of this ever happening.

  Feeling encouraged, I started with the basics: what hardware is in the Wii, and how does it compare to the hardware used in real Macs from the era.
I LOL'd
[−] glenstein 37d ago
I almost think such projects are worth it just to immortalize comments like these. There's a whole psychology of wrongness that centers on declaring that not-quite-impossible things will definitely never happen, because it feels like principled skepticism.
[−] inlined 37d ago
That used to be my thing: wherever our ops manager declared something was impossible, I’d put my mind to proving her wrong. Even though we both knew she might declare something impossible prematurely to motivate me.

My favorite was “it’s impossible to know which DB is failing from a stack trace”. I created STAIN (stack traces and instance names): a ruby library that would wrap an object in a viral proxy (all returns from all methods are themselves proxies) that would intercept all exceptions and annotate the call stack with the “stain”ed tag.

[−] Groxx 37d ago
I've seen more than one half-joke-half-serious chunk of code that would "encode" arbitrary info into stack traces simply by recursively calling fn_a, then fn_s, fn_d, and fn_f before continuing with the actual intended call, giving you a stack trace with (effectively) "asdf" in it.

They've also been useful more than once, e.g. you can do that to know what iteration of a loop failed. There are of course other ways to do this, but it's hard to beat "stupid, simple, and works everywhere" when normal options (e.g. logs) stop working.

[−] glenstein 37d ago
Well you're doing gods work as far as I'm concerned. Conflating difficulty in practice with impossibility in principle is, to my mind, a source of so much unnecessary cognitive error.
[−] prpl 37d ago
Adversarial software development is also when I do my best work
[−] alexchantavy 37d ago
The solution to every software problem is another layer of indirection :-)
[−] btown 37d ago
Similarly, one of the great things about Python (less so JS with the ecosystem's habit of shipping minified bundles) is that you can just edit source files in your site_packages once you know where they are. I've done things like add print statements around obscure Django errors as a poor imitation of instrumentation. Gets the job done!
[−] dj68k 37d ago
I'm remindded of my favorite immortalized comment, "No wireless. Less space than a Nomad. Lame." Rob Malda of Slashdot, 2001, dunking on the iPod when it debuted.
[−] Groxx 37d ago
They're kinda like high-effort shitposts. Which are my absolute favorite kind. The worse the effort/reward payoff, and the more it makes you ask "WHY??!!?", the better.
[−] mlaretallack 37d ago
100% agree, I find that sometimes I hit a dead end, but the things I build or learn on the way are usable at a later date.
[−] gxs 37d ago
Yes, I’ve found at work that the best way to get me off my ass and work furiously is to tell me something isn’t possible
[−] mikepurvis 37d ago
Love that it's actually linked as well; too bad that user isn't still active.
[−] BlueRock-Jake 37d ago
Agreed. Also who doesn't like knocking a smug commenter down a peg
[−] pnptransistor 37d ago
Now tell me your opinion on P==NP being confirmed within 5 years.
[−] blkhp19 37d ago
I'd be lying if I said it wasn't a very tiny part of my motivation :)
[−] bluedino 37d ago
Wasn't the old Linux joke, don't ask "how do I do X with Linux" (because you'd get ridiculed for not reading the docs) but instead, just state "X isn't possible with Linux" and then someone would show you how it's done?
[−] wpm 37d ago
I have a project on my desk that started as a response to a line in the Adafruit docs for their RP2040 based MacroPad

     It is not possible to add BLE or WiFi at this time to the MacroPad.
Oh yeah, really? There is a port hanging off the side that can be reconfigured for UART, are you sure Adafruit, what if I add an ESP32?
[−] xeonax 36d ago
Its a great motivator, happened with me too, I once asked a question about getting the original camera on custom rom and got this as a response [1]. This lead to 2 year long project [2] and an awesome time full of learnings and collaboration

[1] https://xdaforums.com/t/how-do-i-port-pocos-miui-camera-to-c...

[2] https://xdaforums.com/t/anxcamera-closed-on-xda-only-16th-fe...

[−] bfirsh 36d ago
I got the idea of writing an emulator in JavaScript in the pre-Chrome era, circa 2007. I remember searching around trying to find whether somebody had done it before. It seemed not, and somebody on a forum declared “that’s not possible”.

To me, it was obviously possible, and I was determined to prove them wrong.

Anyway, this now exists because of that: https://github.com/bfirsh/jsnes

[−] bsimpson 37d ago

> Readers with a keen eye might notice some issues:

> - Everything is magenta.

was fun too

[−] eek2121 37d ago
Neat, and kudos! Reminds me of my young hobbyist days. I wish low level dev work was that approachable now.

Back in the old days, it was REALLY easy to initialize VGA and throw pixels around in ASM, C, or C++. The 6502 and related chips were relatively easy chips to build stuff for, even though tooling was non-existent. Shoot, you could do some really awesome things on a Tandy CoCo2 and BASIC of all things.

It feels like engineering has made this type of thing inaccessible. Most systems require a ton of knowledge and expertise. There is no easy 'in' for someone with a special interest in development. Even worse, AI is artificially dumbing things down, while making things even more inaccessible.

[−] lampiaio 37d ago
As someone who's been trying to do something VERY similar (port Mac OS 9 to the Nintendo Wii U), all I can say is I'm 1) absolutely impressed, and 2) absolutely encouraged, as my project keeps telling me "this is impossible" at every opportunity.
[−] leonidasv 37d ago
Nice work and write-up!

A side note: you embedded .mov videos inside tags. This is not compatible with all browsers (notably Chrome and Firefox), which won't load the videos.

[−] gauravkashyap6 36d ago
What stood out to me is how much of this worked because of strong abstraction boundaries.

It’s interesting because we don’t often think about OS-level abstractions in the same way anymore — but projects like this really show how powerful they are when they’re done right.

Makes me wonder how feasible something like this would be with modern systems, where things feel more tightly coupled and security constraints are much stricter.

[−] asimovDev 36d ago
I hope OP is still reading comments. I noticed that the project was written in Xcode (the repo even has the xcodeproj folder) but in some screenshots I see CLion. Did you switch at some point or were you using both throughout the development simultaneously?

Amazing writeup, love this types of blog posts and hope the hawaii trip was enjoyable

[−] mackid 37d ago
Congrats, great project and great writeup. That would have won MacHack back in the day.

Now that the MacBook Neo has an A18, I wonder if you could get MacOS running on an iPhone? :)

[−] hoten 37d ago
Wonderful write up, thank you for sharing!

> In the end, I learned (and accomplished) far more than I ever expected - and perhaps more importantly, I was reminded that the projects that seem just out of reach are exactly the ones worth pursuing.

Couldn't agree more. I've had my own experience porting something that seemed like an intractable problem (https://news.ycombinator.com/item?id=31251004), and when it finally comes together the feeling of accomplishment (and relief!) is great.

[−] tiffanyh 37d ago
Amazing work.

If you like this story, you might also like the story of how Mac OS X was ported to Intel as well.

https://news.ycombinator.com/item?id=4091216

[−] hirvi74 37d ago
Exceptional work. While it may not mean much, I am truly impressed. I like to toy with reverse engineering here and there, but such a port like this would take me multiple lifetimes.

Not to distract too much from the main topic, but what do you think about the Hopper disassembler? I have only used Radare2, IDA Pro, and Ghidra. Though, I haven't used the latter two on MacOS. What do you prefer about Hopper? I have been hesitant to purchase a license because I was never sure if it was worth the money compared to the alternatives.

[−] tombelieber 37d ago
This rules. It’s exactly the kind of cursed side quest that sounds fake until you read the writeup and realize you actually did the work.
[−] carlosjobim 37d ago
They are successfully porting Mac OS onto every kind of modern computer over at the hackintosh subreddit, and I can't understand why there is so little interest for this stuff in the "hacker" sphere.

Surely, it must be a better option than Linux if you want to get the most out of a PC computer? At least for 10 more years.

https://www.reddit.com/r/hackintosh/

[−] zadikian 37d ago
My favorite part of this is the detour to ask for the IOUSBFamily src on IRC
[−] nickpeterson 37d ago
The one that really bugs me is the Apple TV. It would be a great little box to use for terminals/thin client style work and there are a ton of old cheap ones. Having a $50 dollar used box that was low power and could run OSX would be great.
[−] willamhou 37d ago
Had a very similar issue porting a hypervisor to ARM S-EL2. Writes would succeed, there were no faults, and everything looked reasonable in GDB, but the other side never saw the data. The root cause was that Secure and Non-Secure physical address spaces were backed by different memory even at the same address, and a single PTE bit selected between them. That took me much longer to understand than I’d like to admit.
[−] monkpit 37d ago

> There is a zero percent chance of this ever happening.

Honestly, I would have said the same. Great work!

[−] samtheDamned 37d ago
This was an incredible read! Especially for what looks like the first post to this blog too? I wanted to subscribe to the RSS feed but unfortunately it gives a 404 error.
[−] drzaiusx11 36d ago
I wonder what, if anything significant, has changed architecturally from osx to modern macos and how this post could be used as a guide for future porting efforts (aside from the obvious 2 CPU isa changes over the last 20 years)
[−] faisalfakih 36d ago
Incredible project. The dual-framebuffer RGB -> YUV conversion trick is really clever. Really entertaining read as well!
[−] stuaxo 36d ago
Great work and writeup.

I wonder if the YUV conversion could be offloaded somehow to the ARM inside the Hollywood or somehow using a shader (or equivalent) if the graphics were accelerated - though maybe this is way way too much.

[−] unanonymousanon 37d ago
This is extraordinary, not only pushing the limit but documenting everything so clearly to show people what can be accomplished with time and dedication. Thank you for such thorough documentation, and congrats on getting it done!
[−] sagoshi 36d ago
hand-rolled iokit drivers and a bootloader to get xnu running on 88mb of ram with cpu-bound yuv-to-rgb conversion at 60fps, all because the wii's powerpc 750cl is close enough to a g3 imac that darwin mostly just worked. solid systems work and a genuinely useful writeup but might try on a dreamcast personally. rom burns
[−] hassaanr 37d ago
In love with projects that are done solely because 'why the hell not'. Fantastic writeup and work.
[−] bsimpson 37d ago
This is excellent.

YUV appears to be a PAL-specific color space. I wonder how off an NTSC Wii would be. Presumably it would have the wrong color space until an equivalent conversion scheme was devised for NTSC.

I was surprised to see regional color spaces leak into the project, but I presume that Nintendo's iOS (the coincidentally-named system this is replacing) could handle that abstraction for game developers.

[−] rajptech 36d ago
The PowerPC-to-Intel transition still has the cleanest binary-format story in mainstream consumer OS history — Rosetta 1 was better engineering than people remember. Wild to see the Wii hardware resurrected for this.
[−] p0seidon 37d ago
This is incredible. I wonder when an LLM will pull this knowledge out to help someone down the line who would never have had the craft to pull this off, as it requires so much depth and broad skill. Admirable.
[−] cyrialize 37d ago
The Wii is very moddable. I've modded my Wii in the past just for playing modded versions of Super Smash Brother Melee (mainly training packs, like flashing a red light when I miss an L-cancel).
[−] crusty 35d ago
To each his own and all that but sitting in a hotel room hacking on a computer while on vacation (in Hawaii!) is PTSD trigger-warning territory for me.
[−] MaxLeiter 37d ago
Great write-up. I love hardware running software it shouldn’t support
[−] rbanffy 36d ago
What's not to love? A small and beautiful PowerPC Unix workstation, something IBM hasn't done in a long, long time. How far does MacPorts go with a PPC?
[−] swiftcoder 37d ago
Damn, that's some dedication! Congrats on getting it running
[−] joshstrange 36d ago
So freaking cool and I really loved the writing style. One thing that surprised me was working on this while on a plane. I find it incredibly difficult to do normal or even limited work while on a plane (thankfully I fly rarely) but working on a hardware project like this on a plane feels like playing on hard mode.

Kudos to the author for being able to do make real progress in such a hostile (IMHO) environment.

[−] fortran77 36d ago
There was a Windows NT 4.0 for PowerPC. And several people have had this running on the Wii. https://github.com/Wack0/entii-for-workcubes

Much easier to do, because of the superior, more modern architecture of Windows NT. (It's not based on Apollo-era OS like OSX is.)

[−] zdware 37d ago
Fun post.

Always great when your debugging feedback is via a led xD

[−] OhMeadhbh 37d ago
Presumably this means you could also port MacOS 9 if you were okay with writing a few drivers and patching some virtual ROMs.