How to determine operating system in elisp?

ljs picture ljs · Nov 30, 2009 · Viewed 15.9k times · Source

How do I programmatically determine which OS Emacs is running under in ELisp?

I would like to run different code in .emacs depending on the OS.

Answer

scottfrazer picture scottfrazer · Nov 30, 2009

The system-type variable:

system-type is a variable defined in `C source code'.
Its value is darwin

Documentation:
Value is symbol indicating type of operating system you are using.
Special values:
  `gnu'         compiled for a GNU Hurd system.
  `gnu/linux'   compiled for a GNU/Linux system.
  `darwin'      compiled for Darwin (GNU-Darwin, Mac OS X, ...).
  `ms-dos'      compiled as an MS-DOS application.
  `windows-nt'  compiled as a native W32 application.
  `cygwin'      compiled using the Cygwin library.
Anything else indicates some sort of Unix system.