Home > Software engineering >  Is it possible to move MacOS TMPDIR to another drive?
Is it possible to move MacOS TMPDIR to another drive?

Time:02-13

Some programs write to the macOS TMPDIR that is on the booth volume, but unfortunately, some write huge files on it (for scratch disk, Lightroom for example) and this depletes the available space, but more importantly the remaining HD space on the boot volumes (especially nowadays with Apple's soldered SSDs) the remaining pace is not enough for the scratch disk and it fails. I experience it a lot with Lightroom doing Panorama,s temp files can be hundred of Gigagbytes. Unfortunately, you can't set the scratch disk location, contrary to photoshop. It writes to the TMPDIR.

So I would like to move that TMPDIR to another external SSD. I tried the symbolic link but unfortunately, I don't have the permission to overwrite or rename the current temporary folder.

Maybe there's a way to change the way the TMPDIR is create so it does it on another drive than the boot drive, or maybe I could get the permission to modify the current one.

Thanks.

Given the fact that lots of program used that location that is often too small, it would be a major boon to get a method to put that TMPDIR on another drive.

Thanks

CodePudding user response:

Thanks, I managed to do it, by disabling SIP and then create a symbolic link to another drive as a replacement of the TMPDIR folder.

Original TMPDIR was T : /var/folders/jc/myw_64vd1vb2zsn9wps4_xnh0000gp/T

More exactly I created a symbolic to my other drive folder in the folder myw_64vd1vb2zsn9wps4_xnh0000gp and named it A.

Then I renamed the T Folder to G and then the symbolink link A to T. You've to be quick as the OS recreates T quickly.

Of course, Lightroom must be quit before doing that. But it works.

It works, but of course, you've to disable SIP which is a pain. Also, after that photoshop doesn't work anymore, other programs mays fail also.

Now, the real solution would be to tell mac os to create the temp folder to and external drive. But that's another topic. I feel it has to to with the mktemp command, If we could ask it to use and external drive it would be the perfect solution.

So the solution was to disable SIP, and then you can move the TMPDIR with a symbolic link.

CodePudding user response:

Have you tried TMPDIR=/your/tmp/dir open -n /Applications/Lightroom.app from terminal?

  • Related