npm install macos-release

Get the name and version of a macOS release from the Darwin version

About macos-release

The npm package "macos-release" serves a crucial role for developers working with macOS systems by providing an efficient way to determine the macOS version using the Darwin version number. This node module is particularly valuable for applications that need to ensure compatibility with different macOS releases or for system monitoring tools that track the operating system version. By simply inputting the Darwin version, "macos-release" returns an object containing the name and version of the macOS, making it easier for developers to perform checks and balances within their software environments. This package supports a wide range of macOS versions, ensuring broad applicability and utility in various development scenarios.

To begin using "macos-release" in your project, the installation process is straightforward and requires only a single command: npm install macos-release. This simplicity accelerates the setup process, allowing developers to integrate it into their projects without hassle. Once installed, the module can immediately translate Darwin version numbers into readable macOS release information, such as converting '13.2.0' to {name: 'Mavericks', version: '10.9'}. This functionality is indispensable for developers who need to tailor their applications to specific versions of macOS, ensuring optimal performance and compatibility across different environments.

The "macos-release" module is continuously updated to support new macOS versions as they are released, which provides developers with up-to-date tools to manage version detection in their applications. The package's utility in simplifying complex version checks into manageable data points makes it a must-have tool in the arsenal of any developer working with macOS applications. By leveraging "macos-release", developers can enhance their software's adaptability and maintain smoother operations across various macOS systems.

More from sindresorhus

sindresorhus npm packages

Find the best node modules for your project.

Search npm

path-key

Get the PATH environment variable key...

Read more
,

slash

Convert Windows backslash paths to slash...

Read more
,

is-wsl

Check if the process is running inside Windows Subsystem for Linux (Bash on...

Read more
,

log-symbols

Colored symbols for various log levels...

Read more
,

default-browser-id

Get the bundle identifier of the default browser (macOS). Example: com.apple...

Read more
,

run-applescript

Run AppleScript and get the...

Read more
,

default-browser

Get the default...

Read more
,

bundle-name

Get bundle name from a bundle identifier (macOS): `com.apple...

Read more
,

os-name

Get the name of the current operating system...

Read more
,

windows-release

Get the name of a Windows version from the release number: `5.1...

Read more
,

macos-release

Get the name and version of a macOS release from the Darwin...

Read more

Dependencies

Core dependencies of this npm package and its dev dependencies.

ava, tsd, xo

Documentation

A README file for the macos-release code repository. View Code

macos-release

Get the name and version of a macOS release from the Darwin version
Example: 13.2.0{name: 'Mavericks', version: '10.9'}

Install

$ npm install macos-release

Usage

import os from 'node:os';
import macosRelease from 'macos-release';

// On a macOS Sierra system

macosRelease();
//=> {name: 'Sierra', version: '10.12'}

os.release();
//=> 13.2.0
// This is the Darwin kernel version

macosRelease(os.release());
//=> {name: 'Sierra', version: '10.12'}

macosRelease('14.0.0');
//=> {name: 'Yosemite', version: '10.10'}

macosRelease('20.0.0');
//=> {name: 'Big Sur', version: '11'}

API

macosRelease(release?)

release

Type: string

By default, the current operating system is used, but you can supply a custom Darwin kernel version, which is the output of os.release().

Related


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.