The CYGWIN environment variable

The `CYGWIN` environment variable
Prev | Chapter 3. Using Cygwin | Next

## The `CYGWIN` environment variable

### Implemented options

The `CYGWIN` environment variable is used to configure many global settings for the Cygwin runtime system. It contains the options listed below, separated by blank characters. Many options can be turned off by prefixing with `no`.

- `(no)export` - If set, the final values of these settings are re-exported to the environment as `CYGWIN` again. Defaults to off.

- `error_start:Win32filepath` - if set, runs `Win32filepath` when cygwin encounters a fatal error, which can be useful for debugging. Defaults to not set.

  `Win32filepath` is typically set to gdb or dumper. If giving a path in `Win32filepath`, note that it is a Windows-style path and not a Cygwin path.

  The filename of the executing program and it's Windows process id are appended to the command as arguments.

  Note: This takes priority over writing core dump or .stackdump files, if enabled by `setrlimit(RLIMIT_CORE)` (e.g. via ulimit -c).

  Note: This has no effect if a debugger is already attached when the fatal error occurs.

  Note: The command invoked must either (i) attach to the errored process with `DebugActiveProcess()`, or (ii) forcibly terminate the errored process (with `TerminateProcess()` or similar), as otherwise the errored process will wait forever for a debugger to attach.

- `(no)glob[:ignorecase]` - if set, command line arguments containing UNIX-style file wildcard characters (brackets, braces, question mark, asterisk, escaped with \) are expanded into lists of files that match those wildcards. This is applicable only to programs run from non-Cygwin programs such as a CMD prompt. That means that this setting does not affect globbing operations for shells such as bash, sh, tcsh, zsh, etc. Default is set.

  This option also accepts an optional `[no]ignorecase` modifer. If supplied, wildcard matching is case insensitive. The default is `noignorecase`

- `(no)pipe_byte` - if set, Cygwin opens pipes in byte mode rather than message mode. This is the default starting with Cygwin 3.4.0.

- `proc_retry:n` - causes `fork()` and `exec*()` to retry n times when a child process fails due to certain windows-specific errors. These errors usually occur when processes are being started while a user is logging off.

- `(no)reset_com` - if set, serial ports are reset to 9600-8-N-1 with no flow control when used. This is done at open time and when handles are inherited. Defaults to set.

- `(no)wincmdln` - if set, the windows complete command line (truncated to ~32K) will be passed on any processes that it creates in addition to the normal UNIX argv list. Defaults to set.

- `(no)winjitdebug` - if set, non-Cygwin executables started from a Cygwin process will have their error mode reset to the system default. That means, if they don't call SetErrorMode() explicitly, the OS will display error dialog boxes in the GUI if some fatal error occurs. Defaults to not set, so fatal errors in a non-Cygwin child process will just result in an error code be propagated back to the parent process.

- `winsymlinks:{lnk,native,nativestrict,sys}`

  - If set to just `winsymlinks` or `winsymlinks:lnk`, Cygwin creates symlinks as Windows shortcuts with a special header and the R/O attribute set.

  - If set to `winsymlinks:native` or `winsymlinks:nativestrict`, Cygwin creates symlinks as native Windows symlinks on filesystems and OS versions supporting them.

    The difference between `winsymlinks:native` and `winsymlinks:nativestrict` is this: If the filesystem supports native symlinks and Cygwin fails to create a native symlink for some reason, it will fall back to creating Cygwin default symlinks with `winsymlinks:native`, while with `winsymlinks:nativestrict` the `symlink(2)` system call will immediately fail.

  - If set to `winsymlinks:sys`, Cygwin creates symlinks as plain files with the `system` attribute, containing a magic cookie followed by the path to which the link points.

  Note that this setting has no effect where Cygwin knows that the filesystem only supports a creating symlinks in a specific way.

  For more information on symbolic links, see the section called “Symbolic links”.

- `disable_pcon` - if set, pseudo console support in pty will be disabled. This is for programs which do not work properly under pty with pseudo console enabled. Defaults to not set.

### Obsolete options

Certain CYGWIN options available in past releases have been removed over time for one reason or another. These obsolete options are listed below.

- `(no)binmode` - This option has been removed because all file opens default to binary mode, unless the open mode has been specified explicitly in the open(2) call.

- `(no)detect_bloda` - No case of a BLODA found by this option has been reported in years.

- `(no)dosfilewarning` - This option had been disabled for quite some time and nobody missed it.

- `check_case` - This option has been removed in favor of real case sensitivity and the per-mount option "posix=[0|1]". For more information, read the documentation in the section called “The Cygwin Mount Table” and the section called “Case sensitive filenames”.

- `codepage:[ansi|oem]` - This option controlled which character set is used for file and console operations. Since Cygwin is now doing all character conversion by itself, depending on the application call to the `setlocale()` function, and in turn by the setting of the environment variables `$LANG`, `$LC_ALL`, or `$LC_CTYPE`, this setting became superfluous.

- `(no)envcache` - Originally, `envcache` controlled caching of environment variable conversion between Win32 and POSIX. The default setting works fine, the option was just useless.

- `forkchunk:[intval]` - This option allowed to influence the `fork()` function in the way the memory of the parent process gets copied to the child process. This functionality was only useful for Windows 95/98/Me.

- `(no)ntea` - This option has been removed since it only fakes security which is considered dangerous and useless. It also created an uncontrollably large file on FAT and was entirely useless on FAT32.

- `(no)ntsec` - This option has been removed in favor of the per-mount option "acl"/"noacl". For more information, read the documentation in the section called “The Cygwin Mount Table”.

- `(no)server` - Originally this option had to be enabled on the client side to use features only available when running cygserver. This option has been removed because Cygwin now always tries to contact cygserver if a function is called which requires cygserver being available. For more information, read the documentation in the section called “Cygserver”.

- `(no)smbntsec` - This option has been removed in favor of the per-mount option "acl"/"noacl". For more information, read the documentation in the section called “The Cygwin Mount Table”.

- `(no)strip_title` - Removed because setting the Window title can be controlled by the application via Escape sequences.

- `(no)title` - Removed because setting the Window title can be controlled by the application via Escape sequences.

- `(no)transparent_exe` - This option has been removed because the behaviour it switched on is now the standard behaviour in Cygwin.

- `(no)traverse` - This option has been removed because traverse checking is not quite correctly implemented by Microsoft and it's behaviour has been getting worse with each new OS version. This complicates its usage so the option has been removed for now.

- `(no)tty` - If set, Cygwin enabled extra support (i.e., termios) for UNIX-like ttys in the Windows console. This option has been removed because it can be easily replaced by using a terminal like mintty, and it does not work well with some Windows programs.

- `(no)upcaseenv` - This option could be used to convert all environment variables to uppercase. This was the default behavior in older releases of Cygwin. Since keeping the case of environment variables intact is POSIXly correct, Cygwin now does not change the case of environment variables, except for a restricted set to maintain minimal backward compatibility. The current list of always uppercased variables is:

        COMMONPROGRAMFILES
        COMSPEC
        PATH
        SYSTEMDRIVE
        SYSTEMROOT
        TEMP
        TMP
        WINDIR

Prev | Up | Next
proc | Home | POSIX accounts, permission, and security