How to determine operating system in elisp?

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.


  • The system-type variable:

    system-type is a variable defined in `C source code'.
    Its value is darwin
    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.