Next: , Previous: , Up: Writing to Files   [Index]


7.3.5.5 temporary-file-directory—a user option

The default directory for temporary files is controlled by the variable temporary-file-directory. This variable gives the user a uniform way to specify the directory for all temporary files. It will have a default value consistent with the operating system so it does not need to be explicitly created.

Variable: temporary-file-directory

This variable specifies the directory name for creating temporary files. Its value should be a directory name, but a program should be able to handle a directory file name instead.

The default value is determined in a reasonable way for your operating system; it is based on the ‘TMPDIR’, ‘TMP’ and ‘TEMP’ environment variables, with a fall-back to a system-dependent name if none of these variables is defined. At the time of writing this, this variable’s default value is:

/var/folders/x_/v2pfz45s7h3245q6wlvvvnyh0000gn/T/

The variable’s value can be customized from within Emacs.

The directory /var/folders/ is owned by ‘root’, but the folders x/ and above are owned by the User. x/ was apparently created at the time the User account was created, and the folders inside it were created in the recent past.

This variable works well as the optional default directory for expand-file-name.