Alex Rivera | Logout

How to determine operating system in elisp?

Asked 2009-11-30T00:14:28.977
110

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.

Edit
Report

1 Answer

114

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.
answered 2009-11-30T00:37:55.463

Your Answer