--- a/src/include/ngspice/defines.h
+++ b/src/include/ngspice/defines.h
@@ -82,8 +82,8 @@
 #define DIR_TERM            '/'
 #define DIR_CWD             "."
 
-#define TEMPFORMAT          "/tmp/%s%d"
-#define TEMPFORMAT2         "/tmp/%s%d_%d"
+#define TEMPFORMAT          "@TERMUX_PREFIX@/tmp/%s%d"
+#define TEMPFORMAT2         "@TERMUX_PREFIX@/tmp/%s%d_%d"
 #define SYSTEM_PLOT5LPR     "lpr -P%s -g %s"
 #define SYSTEM_PSLPR        "lpr -P%s %s"
 #define SYSTEM_MAIL         "Mail -s \"%s (%s) Bug Report\" %s"
