Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why when use sys.platform on Mac os it print "darwin"?

Tags:

In Python, when I type sys.platform on the Mac OS X the output is "darwin"? Why is this so?

like image 481
Sam moh Avatar asked May 23 '13 19:05

Sam moh


People also ask

Why is Mac called Darwin?

But why do the macOS versions of apps carry this name? Because macOS is, along with iOS and tvOS, powered by a piece of open source, BSD-based software called Darwin. Like many open source operating systems, Darwin even has a mascot: Hexley the Platypus.

Are Darwin files for Mac?

It was originally released in March 1999, and currently runs on PowerPC-based Macintosh computers, as well as Intel-compatible platforms. Darwin forms the core of Mac OS X, and most software written for it should be able to run unchanged in Mac OS X.

Is macOS and Darwin the same?

Darwin is the core upon which macOS (previously Mac OS X, and OS X) runs on. It is derived from NextSTEP, which itself is built upon a BSD and Mach core, but Darwin is the open source portion of macOS.

What does Darwin mean in Python?

Darwin forms the core set of components upon which Mac OS X and iOS are based. Even the OS X platform itself reports itself as "Darwin" when you ask it: $ uname Darwin. Python merely uses that same platform identifier.


2 Answers

Because the core of Mac OS X is the Darwin OS.

Quoting from the linked WikiPedia page:

Darwin forms the core set of components upon which Mac OS X and iOS are based.

Even the OS X platform itself reports itself as "Darwin" when you ask it:

$ uname Darwin 

Python merely uses that same platform identifier.

like image 71
Martijn Pieters Avatar answered Nov 19 '22 00:11

Martijn Pieters


To expand on the other answers: Darwin is the part of OS X that is the actual operating system, in a stricter sense of that term.

To give an analogy, Darwin would be the equivalent of Linux - or Linux and the GNU utilities - while Mac OS X would be the equivalent of Ubuntu or another distribution. I.e. a kernel, the basic userspace utilities, and a GUI layer and a bunch of "built-in" applications.

like image 23
millimoose Avatar answered Nov 19 '22 00:11

millimoose