Abdennour TOUMI Abdennour TOUMI - 2 months ago 7x
Node.js Question

os.platform() returns darwin instead of OSX


The above JS instruction returns the name of OS .

  • When it is runned on Ubuntu , it returns


  • When it is runned on Macbook, it returns


I am wondered why does not return
.. ?

is a fork of osx ?

How to get the type of OS under MAC using Node.js ?


Darwin is not OSX, OSX is Darwin.

Darwin is the core of OSX, in the same way, Linux is the core of Debian, Ubuntu, and every other Linux distributions.

Since the open source project is dead, you can safely assume that a platform identified as Darwin is either macOS (including OSX), iOS, watchOS or tvOS, for the mac, iPhone, apple watch and apple tv.

While you can't make the shortcut darwin => OSX blindly, I don t know of any port of node.js for the others device, so yes, if you get darwin, you can be almost sure it is a macOS device, but it could be another version than OSX.