Setting TMPDIR in Maya.env is not working

Setting TMPDIR in Maya.env is not working

rogueninjacreative
Participant Participant
2,518 Views
4 Replies
Message 1 of 5

Setting TMPDIR in Maya.env is not working

rogueninjacreative
Participant
Participant

Hi!

 

I've edited the Maya.env file in ~/Library/Preferences/Autodesk/maya/2020 and added:

 

TMPDIR = '/Volumes/NVMe Array/Caches'

 

After restarting Maya and using the getenv 'TMPDIR' command, the variable has not been changed.

 

I also tried setting the variable in Maya using putenv 'TMPDIR' '/Volumes/NVMe Array/Caches'. Then, getenv DOES return the new path until I restart Maya, then the path has reverted to the default again.

 

Does anyone know why this is happening?

 

I'm using Maya 2020 on macOS 10.15.6

Accepted solutions (1)
2,519 Views
4 Replies
Replies (4)
Message 2 of 5

rogueninjacreative
Participant
Participant

Also, I have confirmed that the Maya.env file is being picked up by Maya.

 

I added a random variable TEST=testing to Maya.env and after loading Maya, getenv TEST does return testing. So, the issue seems to be only with the TMPDIR environment variable.

0 Likes
Message 3 of 5

rogueninjacreative
Participant
Participant

I just found this in Setting environment variables using system commands:

 

"The variables set in the operating system take priority over any settings in the Maya.env file."

 

So, apparently, since TMPDIR is already set on macOS somewhere in /var/folders/ I can't override it.

 

How, then, do I make Maya store its temporary files in another location without changing TMPDIR at the system level?

0 Likes
Message 4 of 5

rogueninjacreative
Participant
Participant
Accepted solution

The solution to this is to run Maya from the command line.

 

A convenient approach is to create an alias in your .bash_profile (or similar) that sets the TMPDIR variable and runs the Maya executable:

 

 

alias maya="TMPDIR=path/to/temp /Applications/Autodesk/maya2020/Maya.app/Contents/bin/maya"

 

 

The first part of the alias, "TMPDIR=path/to/temp", sets the path to the new temporary folder.

 

The second part is the command "/Applications/Autodesk/maya2020/Maya.app/Contents/bin/maya" that opens Maya. Note that it is the path to the maya binary for version 2020. Adjust the version number as needed.

 

This approach leaves the default TMPDIR value unchanged for other applications and sets a new value in a separate process just for the instance of Maya that it's running.

Message 5 of 5

lynn_zhang
Alumni
Alumni

Hi @rogueninjacreative 

 

Glad to hear you figured it out and thanks so much for sharing the solution! This will benefit other users in the community with the same issue.





Lynn Zhang
Community Manager