# os-name

> Get the name of the current operating system. Example: macOS Sierra

Latest version **7.0.0** (published 2026-02-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install os-name
pnpm add os-name
yarn add os-name
bun add os-name
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.0.0 |
| Published | 2026-02-02 |
| First published | 2014-06-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 2 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 149 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | os, operating, system, platform, name, title, release, version, macos, windows, linux |

## Links

- npm: https://www.npmjs.com/package/os-name
- Repository: https://github.com/sindresorhus/os-name
- Homepage: https://github.com/sindresorhus/os-name#readme
- Issues: https://github.com/sindresorhus/os-name/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/os-name

## Dependencies (2)

- [macos-release](https://npm.io/package/macos-release.md) ^3.4.0
- [windows-release](https://npm.io/package/windows-release.md) ^7.1.0

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 7.0.0 (latest) — 2026-02-02
- 6.1.0 — 2025-05-22
- 6.0.0 — 2023-11-24
- 5.1.0 — 2022-12-07
- 5.0.1 — 2021-11-11
- 5.0.0 — 2021-08-12
- 4.0.1 — 2021-07-28
- 4.0.0 — 2020-08-29
- 3.1.0 — 2019-04-05
- 3.0.0 — 2018-11-20
- 2.0.1 — 2016-06-20
- 2.0.0 — 2016-06-19
- 1.0.3 — 2015-01-28
- 1.0.2 — 2015-01-17
- 1.0.1 — 2014-10-06
- … 4 more at https://npm.io/package/os-name/versions

## README

# os-name

> Get the name of the current operating system\
> Example: `macOS Sierra`

Useful for analytics and debugging.

## Install

```sh
npm install os-name
```

## Usage

```js
import osName from 'os-name';

// On a macOS Sierra system

osName();
//=> 'macOS Sierra'

// On an Ubuntu system

osName();
//=> 'Ubuntu 20.04.1 LTS'

osName('darwin', '14.0.0');
//=> 'OS X Yosemite'

osName('linux', '3.13.0-24-generic');
//=> 'Linux 3.13'

osName('win32', '6.3.9600');
//=> 'Windows 8.1'
```

## API

### osName(platform?, release?)

By default, the name of the current operating system is returned.

On Linux, it reads the pretty name from `/etc/os-release` when available (e.g., `'Ubuntu 20.04.1 LTS'`, `'Debian GNU/Linux 12 (bookworm)'`). When a custom release is provided, it falls back to `'Linux <version>'`.

You can optionally supply a custom [`os.platform()`](https://nodejs.org/api/os.html#os_os_platform) and [`os.release()`](https://nodejs.org/api/os.html#os_os_release).

## Related

- [os-name-cli](https://github.com/sindresorhus/os-name-cli) - CLI for this module

---
_Source: https://npm.io/package/os-name · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
