Change location of zsh’s process substitution ‘=()’

process-substitutionzsh

zsh is apparently using /tmp/zshXXXXXX to store temporary files created by the process substitution using =(). For example,

$ echo =(echo test)
/tmp/zsh4RmpQZ

However, I would like to change the location to /run to make use of my tmpfs mount.

Is there a configuration option in zsh to change the (default) location of the temporary file in the process substitution using =()?

Best Answer

The zsh shell uses the variable TMPPREFIX when creating temporary files.

According to the manual:

TMPPREFIX

A pathname prefix which the shell will use for all temporary files. Note that this should include an initial part for the file name as well as any directory names. The default is /tmp/zsh.

Testing:

% TMPPREFIX="$HOME"/hello
% echo =(echo test)
/home/kk/hellotwu65k
Related Question