r/linux • • 9d ago

Distro News XNU Linux wants to run macOS apps on Linux by stuffing the entire macOS kernel into the system

https://www.xda-developers.com/xnu-linux-macos-on-linux/
537 Upvotes

132 comments sorted by

190

u/dev_kay47 9d ago

Ok... I think we've reached a point on the timeline in computer history where fairytales try become real. I can't help but wonder what my great grandchildren would have in their time

115

u/Nalivai 9d ago

Rocks, sticks if we're lucky.

1

u/That_Possibility_601 1d ago

hahahaha yepppp

1

u/That_Possibility_601 1d ago

the last tree will die in 2057, i fear

67

u/AiwendilH 9d ago

Okay...that article confused me pretty much, better looking directly at the github page

It's not (only) about running macOS applications but running a complete macOS userspace. I was wondering what the kernel will help if you don't have the proprietary macOS gui toolkit.

But it's not like a virtual machine because they run the xnu kernel as "module" in the linux kernel.

Seems for now you need access to a Mac to create parts of the project. Also question is how to get a legal macOS userspace to run on this? Can anyone just get legal macOS virtualization images?

It sounds like a very interesting project...but I wouldn't count on this giving access to mac applications easily on linux in the near future. (For now it doesn't work on amd64 anyway so not an option for most people).

19

u/ct_the_man_doll 9d ago

Also question is how to get a legal macOS userspace to run on this? 

The only 100% legally unambiguous way is to make a (preferably open source) clone of macOS' user space.

11

u/DesiOtaku 8d ago

make a (preferably open source) clone of macOS' user space

I remember decades ago when people started to work on that with the GNUStep Project with the goal of re-implementing all of Cocoa. Doesn't seem like to got too far mostly because there wasn't that much demand for it compared to to running Windows. I don't know how much demand there is right now despite the growing popularity of macOS.

There is also the fact that most people would want something binary compatible with macOS rather than just have the same API. But one major advantage that Objective-C has over C/C++ is that most function calls are "messages" rather than pointing to a chunk of memory; which means you can actually map API calls in runtime rather than compile time.

30

u/SPEZ_IS_A_JABRONI 9d ago

XDA is such a shit website 

20

u/tukanoid 8d ago

Used to be good tho, at least the forums, used it a lot in my android custom rom hopping/root customization days

13

u/SPEZ_IS_A_JABRONI 8d ago

Those were the days.

4

u/m103 8d ago

I miss them. My nook had a custom, optimized install of Android and was a great, little tablet

3

u/tukanoid 8d ago

Yeah...

6

u/stewartesmith 6d ago

Apple’s EULA has said it’s only for Apple branded hardware for a good long time, so….. if you are running Linux on your Mac…..

3

u/manuelmagic 8d ago

This is probably the only sensible response, thank you for pointing it out.

1

u/steamcho1 2d ago

My biggest concern is over graphics. How can one run a proper userspace without metal? IG they can fit a translation layer there(like Intel did for their gpus) but that sounds even weirder.

0

u/AiwendilH 2d ago

I haven't look at the details of the graphics drivers...but I don't think a translation layer is necessary as they run the macos user-space. What they need is either a real hardware driver that provides all necessary functions for the userspace part of the metal implementation or a pseudo driver that relies in the linux driiver to provide it all. But in both cases they "only" need to provide the hardware abstraction needed by metal..not the whole of metal itself.

(I doubt they go the own hardware driver route as that would probably require a two graphics cards...one for the linux kernel and one that can be used by the kernel module for the xnu kernel)

2

u/steamcho1 1d ago

Programs want and need metal. In Linux it has to be Vulkan under the hood. I am not sure metal-to-vulkan is this mature yet.

1

u/AiwendilH 1d ago edited 1d ago

MacOS programs using this won't be running under the linux distro...that's not what this project does. Simplified what this project seems to do is integrate the xnu kernel in the linux kernel, split the hardware so that each of the two kernels controls it's own part of the computer and then runs the normal operating systems (userspaces) above those two kernels. MacOS programs will run under MacOS with the xnu kernel, linux programs will run under the normal distro with the linux kernel.

What makes this project "special" is that this isn't done by running the second kernel inside a virtual machine but instead as part of the linux kernel.

There is no need for a translation layer from metal to vulkan because macOS programs won't be running under the linux distro where vulkan is a thing..they run under macOS which already has a metal implementation.

What needs to be done is a driver that either splits the hardware of one graphics cards and shared it between the two kernels which then can build their openGL/vulkan/metal abstraction layer on those virtual split cards...or two graphics cards that allow each kernel full access to one.

(But of course that's just my understanding what the project tries to do...take it with a grain of salt, I am not that deeply interested to really look into the exact details)

1

u/steamcho1 1d ago

Writing a metal driver for a GPU would be even harder than a layer. This is why i mentioned intel drivers. They put proton right in the driver because they couldnt realistically make a dx11 implementation that works well. In my vision Vulkan would be another layer between the gpu and macOS.

This has always been the problem with nu-Apple on pc. The programs themselves are kind of incompatible with anything other than Apple hardware.

1

u/AiwendilH 1d ago

But writing a layer is simply not an option in this case as far as I understand it. This is not like wine where you can write windows dlls that have access to linux libraries like vulkan or openGL.

This is a xnu kernel that needs a kernel driver to have access to the hardware (or a driver that gives access to virtual hardware shared with the linux driver)....and macOS userspace that has no access to the linux userspace.

1

u/steamcho1 17h ago

If intel can make a proton driver, why not here? I am far from an expert too but it feel like you could trick xnu to treat whatever layer as a driver. How exactly this would work idk.

1

u/AiwendilH 4h ago

Graphics drivers consist of two parts...the part that directly accesses the hardware usually as part of the kernel (or a kernel module) and a userspace part that offers programs a interface to work with (usually in form of normal libraries). Vulkan, openGL, direct3d and metal are all part of the later...userspace libraries that offer the interface for programs and rely on the hardware driver part.

But this project doesn't deal with userspace...it just reuses the one from macos...which already has the metal libraries and expects a certain hardware driver part to exist. This project is about integrating the xnu kernel in the linux kernel. But that means it can also only provide the hardware part of the driver...which doesn't provide metal but a much lower level interface used by metal.

I guess what could be possible is writing a pseudo hardware driver AND a pseudo metal userspace library that makes use of that part...but from what I gather that's outside the scope of this project (as it's not about the kernel anymore then but indeed providing a userspace translation layer similar to wine...and it would be also a lot more work and kind of defeat the purpose of this project to allow reusing the normal macOS userspace).

1

u/steamcho1 2h ago

Cpu code execution being direct could be interesting. But other than that yes, in order for this approach to add anything significant it needs to come with a metal driver for the hardware. This sounds almost impossible.

183

u/SkinBurnsLikeVampire 9d ago

So basically the WSL method

73

u/swissbuechi 9d ago

Didn't they switch to regular optimized VMs for WSLv2?

59

u/daltorak 9d ago

Yeah, though technically it's one VM, one Linux kernel, and every distro runs its own container inside of that.

21

u/zhongcha 9d ago

...distrobox is that U?

3

u/nhermosilla14 8d ago

Actually, the same is done in ChromeOS. Yes, they could have gone with containers (since it's Linux inside of Linux), but they chose to run a VM and containers inside of it (they did remove the container a few months ago, though, but it took them a long time).

7

u/alex2003super 9d ago

I had no idea each WSL instance wasn't its own VM. TIL. Thanks

28

u/ukezi 9d ago

Yes, V1 did a translation layer, similar to what wine is doing. There are several problems with that as windows and Linux behave differently on a fundamental level in several aspects.

For instance forking a process creates a copy on write copy of the memory in Linux, meaning if both just read the data it's basically free. On windows it has to actually copy the data.

14

u/SwizzleTizzle 9d ago

I don't believe that's correct about WSL1 needing to copy memory when forking.

From memory, the pico providers intercept the fork syscall specifically and call into private/undocumented NT kernel APIs that set it up so both processes are sharing the same physical memory page.

3

u/ukezi 9d ago

Ok, it could be that they implemented stuff like that and didn't document it. Never the less, at least the documented API of windows and Linux fork differ is this behaviour.

-2

u/average_monster 9d ago

it's kinda interesting to me anyway that maybe the translation layer might actually be feasible with ai assist, not that i'd ever want to go back to windows

45

u/exidy 9d ago

Very different. WSL1 was syscall emulation, a compatibility layer either translated or reimplemented Linux system calls and ran an unmodified userland (including glibc etc) on top. There was only one kernel involved, ntoskrnl.exe, the Linux kernel was not required.

This approach boots Darwin's kernel XNU as a kernel module, by handing it specific CPU threads and a chunk of memory, and then interfacing it to Linux (and the real devices) through a special kext that presents virtual I/O etc to the nested kernel. There is no syscall translation, it is more like a type of paravirtualization. That makes it closer to WSL2 than 1, although not entirely the same.

10

u/Max-P 9d ago

Sounds a lot like Xen's paravirtualization like way back when you needed to boot special Xen-enabled Linux kernels as guests.

3

u/Dobsen_Runjie 9d ago

yeah pretty much, just shipping a lightweight vm under the hood instead of translating syscalls

25

u/arbv 9d ago

I mean - it is very cool, but I think that a specialised hypervisor would be a better fit for this. It would truly run both Linux and macOS side by side, not letting one parasite on the other.

9

u/newhacker1746 9d ago

Essentially, yes. There’s no shared filesystem directly either or memory or other things people associate with two kernels or multiple kernels running at the same time. It straddles the boundaries in a clever way but doesn’t really achieve something a hypervisor couldn’t do.

It also requires an apple silicon Mac running Linux because it’s not patching the speific ARM isa the kernel needs. So it’s not even taking sf advantage of Linux as an abstraction layer for the CPU side, or of patches to increase cpu support. It rewrites GPU drivers and whatnot and actually is worse than a hypervisor because rendering is cpu only

4

u/arbv 9d ago

Yep, there was a similar project which allowed running Linux kernel parasiting on the NT kernel. As equally impressive as useless.

4

u/newhacker1746 9d ago

Exactly, very well said. It is, undoubtedly, impressive. Differentiating that from utility is really key. I understand how some people would struggle though

8

u/indvs3 9d ago

Linux Subsystem for Mac anyone?

1

u/BetterAd7552 7d ago

Apple’s Container Machine?

22

u/Whatever801 9d ago edited 9d ago

Why though? What's on Mac uniquely

Edit: okay, there are some good responses here I'll concede

57

u/PureTryOut postmarketOS dev 9d ago

XCode. I don't want to develop iOS apps but I have to, and having to keep a Macbook around for that sucks.

14

u/SanityInAnarchy 9d ago

So I'm not gonna tell you what to actually do, but IIUC the XCode license explicitly requires that you run it on Apple hardware.

This is so much worse than it seems at first glance. Even though a lot of the XCode Commandline Tools is a bunch of open source stuff that you can get on other OSes just fine, I don't think there's a way to legally get a macOS sysroot on non-Apple hardware. So even just building a simple commandline tool for macOS usually legally requires a Mac, with some oddball exceptions (like pure Go).

10

u/quintus_horatius 9d ago

I don't think this precludes installing Linux on your Mac, then using this module.

In fact, I suspect that's the intended (though unstated) use-case.

4

u/SanityInAnarchy 9d ago

True. I was going with what was stated: Having to keep a Macbook around sucks, but that's still required. (Or something similar; I'd want to keep a Mac Studio in a closet somewhere.)

3

u/PureTryOut postmarketOS dev 8d ago

I know, but you can run Linux on macbooks ;) And on a personal note I don't care much about this problem. Work is obviously a different problem however.

1

u/paul_h 8d ago

Zig cross compiles to MacOS. Just posix things though, not the libraries that Apple ship for larger Mac experience.

2

u/stewartesmith 6d ago

The bugs in the Zig toolchain should be enough to discourage its use for anything. At some point I’ll write up the rest of them that I’ve found.

Pity that reporting them upstream is an explicit violation of their code of conduct…..

1

u/paul_h 6d ago

I'm using Zig for cross compiling portable C so am not encountering bugs in .zig sources myself, but good to know.

2

u/stewartesmith 5d ago

No, it has bugs in the C/C++ cross compiler parts that are pretty bad.

1

u/SanityInAnarchy 8d ago

Yep, like Go. "Just POSIX things" is part of it, but you also need to avoid C libraries, because there's nothing like this for C.

(IMO this is all very stupid and Apple should just release an officially-sanctioned sysroot, but it's Apple, so I'm not holding my breath.)

-1

u/gamamoder 9d ago

its not illegal to break a license agreement

9

u/SanityInAnarchy 9d ago

Yes it is? In this case, the agreement is what gives you the (legal) right to that copy in the first place, so it's at least copyright infringement. Same theory behind GPL violations.

1

u/bleebolgoop 8d ago

It’s a civil matter most likely, you’re not catching a criminal charge breaking a EULA.

1

u/SanityInAnarchy 8d ago

You most likely aren't getting in any legal trouble, just like you would probably get away with most piracy.

But if breaking a EULA means it's copyright infringement, that can be a civil and a criminal matter.

1

u/bleebolgoop 8d ago

Depends on the country

2

u/SanityInAnarchy 8d ago

Everything depends on the country, but this applies pretty broadly. There are WTO treaties:

Under the TRIPS Agreement, criminal procedures and penalties are only mandatory in cases of wilful trademark counterfeiting or copyright piracy carried out on a commercial scale.

You're probably fine because it's hard to imagine anyone suing over this, and there are exceptions for things like interoperability. But I wouldn't do this kind of thing at work without my employer's lawyers signing off on it. Outside work, maybe it'd make sense if I had an iPhone but no Macbook, but this is one of the reasons I don't have an iPhone.

1

u/paul_h 8d ago

Criminal vs civil law

1

u/SanityInAnarchy 8d ago

I said 'illegal', I didn't say 'criminal'. But even if that matters, copyright infringement can be both a civil and a criminal offense.

4

u/zarlo5899 9d ago

XTool is better a cli replacement for XCode that is better and work on window mac and linux

2

u/Natural_Cat_9556 9d ago

you can use llvm and splice for objective-c and xtool for swift apps on ios.

12

u/ElePHPant666 9d ago

XCode is industry standard for developing software for iOS and sometimes you have to work on projects other than your own. Still really nice to see that there are other options which could be really nice for open-source mobile apps to support iOS without having to buy an apple computer.

6

u/RainEls 9d ago

Basically everything presume you have xcode on macos. Maybe you could sidestep some steps, but I'm sure you'll run into a blocker eventually. 

2

u/SanityInAnarchy 8d ago

llvm is the thing that requires a sysroot copied from macos. That sysroot comes from xcode or from xcode-commandline-tools, both of which have a license that limits them to Apple hardware only.

(Disclaimer: That's for a macos binary. I don't know what you need for iOS, but I assume it's similar.)

2

u/Natural_Cat_9556 8d ago

yeah i was using this for ios, sounds like the same process.
also, who cares what apple wants, unless you're making some commercial product i doubt this matters.

35

u/Netzath 9d ago

Logic Pro. Pretty good

7

u/Legal-Swordfish-1893 9d ago

Logic used to be a Win32 program….24 years ago..

1

u/Whatever801 9d ago

Yeah that makes sense, though a big part of why that's good is hardware optimization

3

u/onceuponalilykiss 9d ago

Not just that, it's the only "pro" DAW that isn't continuous cost (subs or constant paid upgrades) or inaccessible to average person (reaper).

11

u/sCeege 9d ago

A mistake that new Apple executives will soon rectify. I think they're going to transition everyone to use Creator Studio subscriptions by gating new updates behind it :(

1

u/onceuponalilykiss 9d ago

Hopefully not lol

1

u/sCeege 9d ago

You and me both... my one time purchase of FCP and MotionVFX packs have been the MVP of value lol, but idk, feel like it's all going in the wrong direction now that MotionVFX got moved to the subscription model :(

3

u/Scarlet72 9d ago

I would but catagorise Reaper as inaccessible to the average person. What makes you say that?

1

u/onceuponalilykiss 9d ago

Hand it and logic to your grandma and see which one takes longer to learn.

2

u/Scarlet72 9d ago

Oh, my grandma specifically can hardly use a TV remote never mind professional audio software. It's quite remarkable, really.

2

u/-Outrageous-Vanilla- 9d ago

Ableton is subscription now?

1

u/onceuponalilykiss 9d ago

Ableton charges for updates, which I covered in the original wording of my post.

2

u/-Outrageous-Vanilla- 9d ago

I like paid updates and dislike subscriptions.

Paid upgrades are a honest way to maintain the developers.

4

u/onceuponalilykiss 9d ago

...Logic Pro has neither is the point.

1

u/-Outrageous-Vanilla- 9d ago

On Mac you need to paid to upgrade your Mac when the latest macOS is not supported, or you don't have enough storage for all the Siri AI local models, or the latest macOS makes your Mac slow.

Upgrades are inevitable if you ask me.

Subscriptions on the other hand are not.

2

u/onceuponalilykiss 9d ago

This kind of post is why people are put off by Linux lol.

1

u/RegretFree7723 9d ago

Openlogi

2

u/Netzath 9d ago

Openlogi as for Logitech?

Logicpro is music daw tool :D

1

u/RegretFree7723 9d ago

Thanks, I didn't know about this software

-9

u/stinkycardamom 9d ago

Lots of great linux-native options that are just as good.

2

u/diabolic_recursion 9d ago

For DAWs? Sadly, no. And most certainly not "lots". Cubase and a lot of software instrument plugins is what tethers me to windows at the moment, so I dual-boot. All of that would also work on Mac btw, but not on Linux.

4

u/k1ll3rM 9d ago

Bitwig is Linux native and I highly recommend it! I don't know how good the plugin support is on Linux but there is a project that uses Wine to run Windows plugins

1

u/stinkycardamom 5d ago

Reaper, Bitwig, and Ardour already give good options. Reaper especially for proper commercial use.

Plugins most work through yabridge, but it's hit and miss for sure. Linux options are getting better slowly for VSTs.

3

u/[deleted] 9d ago

[removed] — view removed comment

4

u/stinkycardamom 9d ago

Speaking specifically about DAWs, there are no good ones native to Android at the calibre of Logic Pro.

Reaper is pretty industry standard in a lot of places, and has native linux build. That's before getting into good open source options.

If your point is more about the ability to emulate stuff, then sure it's good to have. I still find it easy not to need to run non-linux apps for my use cases (audio and programming mostly)

6

u/Netzath 9d ago

Reaper is just a DAW engine while LogicPro is entire ecosystem with extensive instruments, synth, sound and effects library.

Different packages for different needs and levels of experience or funds.

1

u/stinkycardamom 9d ago

Speaking as someone who works at a higher level of experience at a company with lots of funds, no. It's more personal preference (but everyone here has to use the same DAW to make projects sharable). People buy 1000s of dollars of their own plugins anyway, even with logic.

And for those who don't have that kind of money, Reaper has a better pricing model, and there are great open source plugins these days.

29

u/Expensive_Poop 9d ago

Why not

We can run windows apps, android apps, why not running macos apps lmao

6

u/visagi 9d ago

I would definitely say that macOS has the highest quality third party apps of any platform, partly due to great Apple libraries, partly due to people actually paying money for them. But in this era of LLM's rather have open source apps I can easily modify to my liking, even if they are less polished.

3

u/S1rTerra 9d ago

It could open the door for productivity apps

3

u/iBoMbY 9d ago

If you could run the native macOS apps from Adobe, this alone would be a big win. Photoshop, Premiere, Illustrator, Lightroom, ...

1

u/generic-d-engineer 8d ago

A ton of open source dev tools. Seems the entire dev ecosystem is Mac first

1

u/Whatever801 8d ago

Like what besides xcode? Nothing I've ever wanted to use is Mac only thats SWE related. Every server on earth runs Linux

1

u/generic-d-engineer 8d ago edited 8d ago

There’s so many little tools I’d love to try which are Mac only or Mac first

Gitup for example has probably the best git ui I’ve ever seen and makes it super intuitive

But even more than that when you go to GitHub to get your tool, it often starts with, “okay for Mac users in zshell you just run brew install…”

0

u/diet_fat_bacon 8d ago

Real devs use git cli

2

u/generic-d-engineer 8d ago edited 8d ago
git add deez_nutz

1

u/npc_housecat 8d ago

A lot of proprietary windows / Mac only tools which don't work properly through wine on Linux,

1

u/farinasa 8d ago

Currently looking to switch my 2016 mac to linux because they refuse to give me updates. I can't update chrome or even run vscode anymore. Being able to run the apps I already run would be great.

0

u/Whatever801 8d ago

Yeah but most of them are already on linux

0

u/farinasa 8d ago

Facetime?

3

u/Whatever801 7d ago

No thanks we just met

1

u/nomenMei 8d ago

I'd say OpenEmu but that would mean also running the emulation cores through a second layer of emulation and that seems like a bit much just to get a snazzy frontend.

1

u/habibexpress 1h ago

WhatsApp and native calling. That’d be amazing!

Native MS apps!! Will make staying on Linux far more palatable

1

u/Paranoidd_ 9d ago

logic pro. fl studio. microsoft suite

22

u/[deleted] 9d ago

[removed] — view removed comment

18

u/CountryFriedToast 9d ago

yeah bro us preview fans have been waiting a long time for this

5

u/nixcamic 9d ago

You joke but I have to have like 8 programs that I had to research, download, and install on windows/Linux just to do what preview does.

5

u/[deleted] 9d ago

[removed] — view removed comment

3

u/CountryFriedToast 9d ago

oh i think that's what they call Quick Look but i feel exactly the same way

1

u/fleemfleemfleemfleem 6d ago

There are apparently still a few PDF handling edge cases that linux doesn't do as well with.

2

u/spiteful_fly 2d ago

I also found out that PureDarwin is gaining a lot of traction again too. They recently overhauled their website and is working on building an OS off of the same kernel as MacOS 26.

1

u/Daggercombot 8d ago

This Is something i have been interested in for a while,but today dont think of list of Mac software Is as large as It was before. Would still be nice though

-16

u/gideonidoru 9d ago

Just. Run. A. Mac. People trying so hard to either make their desktop look like macOS and now trying to run macOS app. Just run a freaking mac already

7

u/dev_kay47 9d ago

It's not just about running " A Mac" It's deeper than you think we looking at technology and creativity. And don't forget the fun part too.. For the hobbiest.

4

u/squishles 8d ago

i have a puter already, i want to pute on it, i don't want more puter.

7

u/mocheeze 9d ago

Imagine giving a shit about people running software on their own hardware.

6

u/childofeye 9d ago

Ok moneybags.

2

u/the_abortionat0r 8d ago

Sorry but people interested in a running one or two Mac programs are not anywhere close to being fucking dumb enough to buy a Mac.

In 2006 Apple used a flawed power delivery chip for their displays that has a high failure rate. They still use that chip, on purpose. Because at the apple store they tell you the screen can't turn on which means they can't diagnose the problem which they claim is needed for warranty claims. This is false and illegal.

Apple refuses to follow open standards which is one of a few reasons games dropped Mac support.

Also nothing supports Mac, not even Apple. You heard that right.

Apple dropped PPC program support after claiming they'd keep support, then did that again with 32bit programs which means al.ost no games pre 2017 but now they are killing x86 support so no games pre 2020 but realistically that's 20022.

So no, nobody here is dumb enough to spend more on a machine that does less, performs worse, breaks, and can't be upgraded.

So take your stupid Mac cultist bullshit out of here.

-14

u/No-Protection-7019 9d ago

et pour cocoa ? C'est surtout ça le plus intéressant, tous les environnement graphique sous linux sont aussi laid que windows.

1

u/Random_-account 8d ago

happy cake day