# How do I check the user's Operating System?
#obsidian/api/faq
---
For most things, you won't need to worry about what operating system the user is running. The Obsidian API abstracts away most of the operating system minutiae. However, there are some moments where it's important to know if the user is on Window vs macOS vs Linux.
> **Example:** handling modifier keys. If you have an event listener and want to know if the is pressing `Ctrl` on Windows/Linux or `Cmd` on macOS, you'll need to discern the OS.
## Sample Code
### Get OS
```ts
var re = (function () {
var e = navigator.appVersion;
return -1 !== e.indexOf("Win")
? "Windows"
: -1 !== e.indexOf("Mac")
? "MacOS"
: -1 !== e.indexOf("X11") || -1 !== e.indexOf("Linux")
? "Linux"
: "Unknown OS";
})()
type IOperatingSystem = "Windows" | "MacOS" | "Linux" | "Unknown OS";
function getOS() {
const { appVersion } = navigator;
if (appVersion.indexOf("Win") !== -1) {
return "Windows";
} else if (appVersion.indexOf("Mac") !== -1) {
return "MacOS";
} else if (appVersion.indexOf("X11") !== -1) {
return "Linux";
} else {
return "Unknown OS";
}
}
```
### If you just need a single OS
```ts
function isMacOS() {
return navigator.appVersion.indexOf("Mac") !== -1;
}
```
## Small Gotcha
It's very tempting to use NodeJS's `os` package for checking the operating system. This package will not be available on mobile. So if you have `isDesktopOnly` set to `false` in your manifest file, double check that you're not using any NodeJS packages.