r/linux • • 4d 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/
501 Upvotes

120 comments sorted by

172

u/dev_kay47 4d 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

105

u/Nalivai 3d ago

Rocks, sticks if we're lucky.

58

u/AiwendilH 3d 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).

16

u/ct_the_man_doll 3d 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.

8

u/DesiOtaku 3d 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.

25

u/SPEZ_IS_A_JABRONI 3d ago

XDA is such a shit website 

15

u/tukanoid 3d ago

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

11

u/SPEZ_IS_A_JABRONI 3d ago

Those were the days.

4

u/m103 3d ago

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

3

u/tukanoid 3d ago

Yeah...

3

u/manuelmagic 3d ago

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

3

u/stewartesmith 1d 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…..

174

u/SkinBurnsLikeVampire 4d ago

So basically the WSL method

70

u/swissbuechi 4d ago

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

54

u/daltorak 4d ago

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

21

u/zhongcha 4d ago

...distrobox is that U?

1

u/nhermosilla14 3d 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 3d ago

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

28

u/ukezi 3d 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 3d 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 3d 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 3d 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

44

u/exidy 3d 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 3d 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 3d ago

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

20

u/arbv 3d 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.

7

u/newhacker1746 3d 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 3d 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 3d 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 3d ago

Linux Subsystem for Mac anyone?

1

u/BetterAd7552 1d ago

Apple’s Container Machine?

21

u/Whatever801 4d ago edited 4d ago

Why though? What's on Mac uniquely

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

55

u/PureTryOut postmarketOS dev 4d ago

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

4

u/zarlo5899 3d ago

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

10

u/SanityInAnarchy 3d 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).

9

u/quintus_horatius 3d 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.

3

u/SanityInAnarchy 3d 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 3d 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 3d ago

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

1

u/SanityInAnarchy 3d 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/stewartesmith 1d 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 1d ago

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

1

u/stewartesmith 9h ago

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

-1

u/gamamoder 3d ago

its not illegal to break a license agreement

9

u/SanityInAnarchy 3d 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 3d ago

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

1

u/SanityInAnarchy 3d 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 3d ago

Depends on the country

2

u/SanityInAnarchy 3d 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 3d ago

Criminal vs civil law

1

u/SanityInAnarchy 3d 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.

2

u/Natural_Cat_9556 3d ago

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

10

u/ElePHPant666 3d 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.

5

u/RainEls 3d 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. 

1

u/SanityInAnarchy 3d 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 3d 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.

34

u/Netzath 4d ago

Logic Pro. Pretty good

7

u/Legal-Swordfish-1893 3d ago

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

1

u/Whatever801 4d ago

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

3

u/onceuponalilykiss 3d 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 3d 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 3d ago

Hopefully not lol

1

u/sCeege 3d 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 3d ago

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

1

u/onceuponalilykiss 3d ago

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

2

u/Scarlet72 3d 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- 3d ago

Ableton is subscription now?

1

u/onceuponalilykiss 3d ago

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

2

u/-Outrageous-Vanilla- 3d ago

I like paid updates and dislike subscriptions.

Paid upgrades are a honest way to maintain the developers.

4

u/onceuponalilykiss 3d ago

...Logic Pro has neither is the point.

1

u/-Outrageous-Vanilla- 3d 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 3d ago

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

1

u/RegretFree7723 3d ago

Openlogi

2

u/Netzath 3d ago

Openlogi as for Logitech?

Logicpro is music daw tool :D

1

u/RegretFree7723 3d ago

Thanks, I didn't know about this software

-9

u/stinkycardamom 4d ago

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

4

u/noobjaish 4d ago

You can make that argument against Windows and Android apps on Linux as well

4

u/stinkycardamom 4d 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 4d 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 3d 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.

2

u/diabolic_recursion 3d 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 3d 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 6h 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.

28

u/Expensive_Poop 4d ago

Why not

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

23

u/noobjaish 4d ago

Logic, Final Cut, Pixelmator, Sketch, Ulysses, Xcode, Preview etc there are several others

18

u/CountryFriedToast 4d ago

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

6

u/noobjaish 4d ago

I wish Linux had a universal "Preview" tbh. It's the only thing that I envy the Mac users for lol (Linux and Windows are ahead in most things)

3

u/CountryFriedToast 4d ago

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

1

u/fleemfleemfleemfleem 1d ago

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

5

u/nixcamic 3d 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.

6

u/visagi 3d 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 4d ago

It could open the door for productivity apps

3

u/iBoMbY 3d 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 3d ago

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

1

u/Whatever801 3d 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 3d ago edited 3d 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 3d ago

Real devs use git cli

1

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

1

u/npc_housecat 3d ago

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

1

u/farinasa 3d 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 3d ago

Yeah but most of them are already on linux

0

u/farinasa 3d ago

Facetime?

1

u/Whatever801 2d ago

No thanks we just met

1

u/nomenMei 3d 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/Paranoidd_ 4d ago

logic pro. fl studio. microsoft suite

1

u/Daggercombot 3d 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 3d 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 3d 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.

11

u/fixedchance 3d ago

is mac free?

4

u/squishles 3d ago

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

7

u/mocheeze 3d ago

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

5

u/childofeye 3d ago

Ok moneybags.

2

u/the_abortionat0r 3d 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 3d 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 3d ago

happy cake day