Ran export TMPDIR=~/tmp/ and it broke my node app, can I revert the tmp folder to the default folder? Hey I ran export TMPDIR=~/tmp/ and it changed my temp folder. I was trying to get a Go backend working and an article suggested it. I was a little trigger happy and now this is causing issues with a once working Node app I have. 

The node app is now saying:


  Error: ENOENT: no such file or directory, mkdtemp
  '/Users/myName/tmp/puppeteer_dev_chrome_profile-VYUdd3'


Is there a way to revert the temp var back and fix this problem. Where do env vars live on a mac. I also updated my mac from Mojave to Catalina during this process. Not sure if that has something to do with it too. 

Any help would be appreciated.
TMPDIR needs to point to an existing, user-writable directory. So setting it to ~/tmp is fine as long as ~/tmp actually exists.

By default it points to /var/folders/_d/_SOMERANDOMLOOKINGSTRING/T/ to ensure that every user has their private temp folder. If for whatever reason you loose the definition you can run find /var/folders/_d -user $(whoami) -type d -maxdepth 1 to check that it still exists, and then do

export TMPDIR="$(find /var/folders/_d -user $(whoami) -type d -maxdepth 1)"


to set it back.

In case it doesn't exist any more (which is unlikely as it is protected by SIP), either reboot to have it recreated or run (all three lines)

export TMPDIR=/tmp
export TMPDIR="$(mktemp -d)"
chmod 700 "${TMPDIR}"


to create and assign a new temp folder.