
A Look at PureDarwin – An OS Based on the Open Source Core of macOS - jamieweb
https://www.jamieweb.net/blog/a-look-at-puredarwin/
======
DavidPiper
This was one of my hobbies at University (learning how it works, not
contributing to it, to be clear). This SuperUser question was basically the
culmination of my effort before I ran out of spare time, found a job, etc.

[https://superuser.com/questions/546151/is-it-possible-to-
com...](https://superuser.com/questions/546151/is-it-possible-to-compile-a-
darwin-distro-from-source-like-you-can-a-build-a-li)

I'm super excited that people are still working on this! I miss having the
time to go down rabbit holes, but for those that are there's are people out
there watching!

~~~
DavidPiper
A huge kudos to Jonathan Levin too! It looks like the full set of new *OS
Internals books are now available (last I checked only two volumes were
available) -

[http://newosxbook.com](http://newosxbook.com)

They are the spiritual successors to Amit Singh's Mac OS X Internals: A
Systems Approach ([http://osxbook.com](http://osxbook.com)).

~~~
codetrotter
While we are on the subject of macOS internals.

Do you know where I can read about what it would take to replace WindowManager
and the rest of the desktop environment on macOS?

I would like to make my own implementation of the desktop environment,
including replacing the top bar with the menus and stuff, and replacing the
dock with a dock of my own, as well as replace spotlight search and Finder.
Furthermore to also replace the open file dialog that is called to from
programs when they open files.

~~~
saagarjha
> I would like to make my own implementation of the desktop environment,
> including replacing the top bar with the menus and stuff, and replacing the
> dock with a dock of my own, as well as replace spotlight search and Finder.
> Furthermore to also replace the open file dialog that is called to from
> programs when they open files.

While they may seem like a unified application, these are all separate
components. Dock, Spotlight, and Finder are apps, and the open dialog is an
XPC service.

~~~
codetrotter
How isolated are they from one another? For example, if I manage to replace
the Dock first, does the Dock need to provide a lot of interfaces for the
other parts of the DE to call into?

For example, when an application is started from the spotlight search, its
icon pops up in the dock (if not already there) and becomes active, and when
applications exit they become inactive in the dock and optionally disappear.

------
epaulson
I wish the PureDarwin folks would prioritize clear build instructions. It'd be
really great to see something like a "Linux From Scratch" or process to build
a bootable disk image using only what's in their git repos. (Maybe it exists
but if so it doesn't show up/is linked to from any of the obvious pages of
their wiki)

That seems like a necessary first step towards eventually getting a bootable
ISO that can install a PureDarwin system on a blank machine, physical or
virtual.

------
mukundmr
Apple's Open Source repository has the current version of Catalina's core.
[https://opensource.apple.com/release/macos-10145.html](https://opensource.apple.com/release/macos-10145.html)

Why is PureDarwin on an older version? Lack of volunteers? Too many hacks
required?

~~~
dschuler
10.14.5 is Mojave, and we're still waiting for the latest 10.14.6 Mojave
source. Their open source repo seems to be about 6 months behind at any time.

~~~
jonathanstrange
Isn't that a license violation?

~~~
akvadrako
It’s a BSD license, so they don’t need to release the source.

~~~
jonathanstrange
Ah, okay, that makes sense. Should have looked up the license before asking.
I'll upvote your clarification.

------
Aloha
Why would I want to use Darwin?

macOS has some UI advantages, its the largest reason I use it - but without
cocoa, and all of the core foundations that make OSX, OSX, I just dont see the
point.

~~~
dfox
For me: you don't want to. The underlying Darwin/XNU layer is probably the
most quirky (or depending on your PoV outright broken) unix-ish system you
will see in general use today.

~~~
skissane
z/OS is a much weirder Unix than macOS, although it depends on how you define
"general use". But, there are a lot of enterprises out there which still run
IBM mainframes, even if they often aren't keen on advertising that fact, and a
huge lot of stuff in z/OS now depends on the Unix subsystem, in particular
anything written in Java (which IBM has been heavily encouraging as a
development language on mainframes, resulting in a lot of hybrid apps which
are a mix of newish Java code and ancient COBOL/assembler/etc working
together.)

(Some people will question whether z/OS really counts as a "Unix", but like
macOS, it is actually a certified Unix, and as such has greater official claim
to be Unix than FreeBSD or most Linux does.)

(Addendum: I say "most Linux", because while the vast majority of Linux
distributions are not certified Unix, some have been. Right now, Huawei
EulerOS is a certified Unix based on a Linux distribution. Inspur K-UX is
another Linux distribution which used to have Unix certification, although the
certification has expired–I guess they failed to pay the renewal fees.)

~~~
pjmlp
For others, z/OS has personalities, just like other mainframes and Windows.

What is certified as UNIX is the POSIX personality.

~~~
skissane
I've never heard the term "personality" used with respect to z/OS before, it
certainly isn't standard terminology. (It is standard terminology with respect
to the original design of Windows NT, and IBM's abortive Workplace OS, but
z/OS has little in common with either.)

And strictly speaking, z/OS as a whole is a certified UNIX. Look at the
registration certificate [1], it never mentions UNIX System Services.
Obviously without that component z/OS would fail to pass the certification
tests, but the certification is for the operating system as a whole not just
that component of it.

[1]
[https://www.opengroup.org/openbrand/certificates/1199p.pdf](https://www.opengroup.org/openbrand/certificates/1199p.pdf)

~~~
pjmlp
Maybe I misunderstood its architecture, but I thought that with the language
services and the different kinds of workloads, it also had such clean
separation.

~~~
skissane
Not really. A z/OS program is allowed to call a pretty arbitrary mix of
classical MVS APIs and UNIX system calls. There is no strict separation as
such between "classic MVS programs" and "UNIX programs". An MVS task isn't
classified as a UNIX process until it makes its first UNIX system call
(exception: programs launched via UNIX system calls get classified as UNIX
processes even before they start executing) – some programs start issuing UNIX
system calls as soon as they start, but a program can run for hours or days as
an MVS task, and then suddenly out of the blue start making UNIX system calls,
and then at that point the MVS task will be "dubbed" as a UNIX process. (To be
a UNIX process, the MVS task needs to be assigned a UNIX security identity –
UID and GID – which is the job of the security subsystem – RACF, TopSecret or
ACF2 – if the security subsystem isn't configured to assign a UID/GID to that
MVS task, all UNIX system calls will fail.)

Compare this to Windows NT, where each executable was marked as belonging to a
primary subsystem (Win32, POSIX, OS/2, etc) which is fixed from the time of
process startup. In contrast, z/OS offers the flexibility that any MVS task
can potentially be "dubbed" as a UNIX process at any time. Or similarly, look
at WSL1 in Windows 10 – a process is either a Win32 process which is allowed
to call the Win32 API, or a picoprocess which can call Linux system calls, you
can't mix Win32 calls and Linux calls in the same process. (You can do it via
two processes, one Win32 and one WSL, communicating over IPC; by contrast,
z/OS allows mixing UNIX and classic MVS APIs in the same process/task running
in a single address space). So the separation between "UNIX" and "classic MVS"
in z/OS is actually a lot weaker than in Windows NT, which is why the
"personality" term which was used in the later isn't really applicable to
z/OS.

~~~
pjmlp
Thanks for the overview.

------
ilovecaching
Are there are Darwin hackers lurking on HN? I would pay good money to get a
brief summary of the kernel for kernel hackers such as myself who only know
how things work in Linux. What are the big architectural differences or cool
features not in Linux? Also, how hard is it to upstream changes/get drivers in
mainline?

~~~
wrs
Amit Singh’s excellent book _MacOS Internals: A Systems Approach_ [1] is a bit
outdated now but still recommended if you’re interested in the workings of a
non-Linux commercial OS.

[1] [https://www.amazon.com/Mac-OS-Internals-Approach-
paperback/d...](https://www.amazon.com/Mac-OS-Internals-Approach-
paperback/dp/0134426541)

~~~
monocasa
Jonathan Levin's *OS Internals volumes are an updated version of the same
info, and wonderful.

~~~
n_t
Looks interesting and would love to read/review it. But at $88 a piece for 3
volumes ... hmm!

~~~
svth
Here's a link to the first volume, made available on the book's website:

[http://newosxbook.com/MOXiI.pdf](http://newosxbook.com/MOXiI.pdf)

------
Wowfunhappy
I have to wonder, why does Apple even make Darwin open source?

It doesn’t seem like it’s of much use to Apple—there isn't some large
community of outside contributors submitting pull requests. So why do they
bother?

~~~
s_dev
Licence compliance -- they took the Unix kernel and don't really want to give
back but having now taken the kernel it now has obligations under that licence
to make it available for others.

~~~
Wowfunhappy
Which license? I'm not aware of any obligations to release Darwin's source on
Apple's part—hence how they're able to wait half a year before releasing the
source of new versions.

------
Wowfunhappy
If you don’t mind the fact that they’re closed source, could the original
Apple kexts be used for networking?

~~~
nutjob2
No need, you should be able to use Hackintosh networking kexts which are open
source.

~~~
Wowfunhappy
Oh, good point! Although, that wouldn’t have helped the article author running
VMWare, as the specific kext he needed was Apple-provided and closed source.

~~~
nutjob2
VMWare wants Intel E1000, which has been supported for a while:

[http://osx86drivers.sourceforge.net/](http://osx86drivers.sourceforge.net/)
(Older)
[https://github.com/Mieze/IntelMausiEthernet](https://github.com/Mieze/IntelMausiEthernet)
(Latest)

------
rnd0
I'm not really sure how useful it is for most of us -but it doesn't have to
be. Not all operating systems are general-purpose.

I'm glad to see it continues to be maintained and published though I share the
frustration other's have mentioned about how incomplete it is. There is no
"more", no "less", no "halt", no "shutdown" -those are just a few of the "wtf"
finds that pop up on casual examination.

------
saagarjha
I wonder if GNUstep works on this…

~~~
runjake
It does, insofar as GNUstep really works.

~~~
winrid
How doesn't it?

~~~
runjake
It's old, clunky, and neglected. It's still not up to OpenStep levels, which
in itself wasn't really polished.

~~~
apple4ever
Bingo. And all the old timers refuse to change.

------
orionblastar
I am glad someone is keeping up with Darwin and making a version one does not
need to compile to be able to use.

I wonder if it can run OSX command line programs?

~~~
jki275
If you can run it, and they don't link to cocoa, it should be able to do that
just fine. Apple used to distribute a Darwin iso, I remember running it in the
mid-2000s on an older Mac mini.

------
ngcc_hk
Can it run nvidia card Sk my old mac can be used; windows can run it but it
optimised.

