Possible Homebrew/Flang/Xcode problem

I have been successfully using flang installed by Homebrew on MacOS for several months. Recently, I upgraded MacOS to 15.7 and I upgraded flang to 21.1.1. Since then I get the error:

flang-21: error: unable to make temporary file: Permission denied

I just a few minutes ago upgraded flang to 21.1.2, and that error persists.

I have flang installed on three different Macs, all with MacOS 15.7, and I only see this problem on one of them, the other two installs work correctly. I have done a superficial check of directory permissions and I don’t see anything obvious that could cause this problem, and I can move around to different directories and I get that error message consistently on that one machine. I have the same version of xcode command line tools installed everywhere.

$ softwareupdate --history | grep "Command Line Tools for Xcode"
Command Line Tools for Xcode                       15.1       01/01/2024, 12:37:43  
Command Line Tools for Xcode                       15.3       03/13/2024, 03:30:12  
Command Line Tools for Xcode                       16.0       09/19/2024, 11:42:45  
Command Line Tools for Xcode                       16.1       11/07/2024, 13:01:56  
Command Line Tools for Xcode                       16.2       12/15/2024, 14:20:26  
Command Line Tools for Xcode                       16.3       04/01/2025, 13:48:15  
Command Line Tools for Xcode                       16.4       05/29/2025, 23:55:04  
Command Line Tools for Xcode 26.0                  26.0       09/16/2025, 04:52:52  
Command Line Tools for Xcode                       16.2       09/17/2025, 04:33:04  
Command Line Tools for Xcode                       16.4       09/17/2025, 04:33:04  
Command Line Tools for Xcode 26.0                  26.0       09/17/2025, 04:33:04

The problem seemed to have started about that 09/16/2025 date (you can see that I reinstalled the CLTs to see if that was a problem). I think that was the date date that I upgraded to MacOS 15.7, but I did not happen to notice this flang problem for a few days later.

BTW, there is a new MacOS 26 that is available now, but I usually wait a few weeks to install major OS releases to allow tools like gfortran and flang to keep up. On the other hand, minor upgrades like 15.6 to 15.7 typically do not cause problems, so this is an exception.

I don’t know if this is an flang problem, or a Homebrew problem, an xcode CLT problem, or a problem with my MacOS install/upgrade. Anyone else see this kind of problem recently?

Not sure if the strace command is available, but something like strace -f $COMMAND might give you the pathname or show which component is getting the error. You might also try setting the $TMPDIR and $TMP environment variables explicitly to something like /tmp. to narrow it down a bit more.

1 Like

I reset TMPDIR, and flang now works. Now I’ll need to see why that variable is set differently on the Macs I’m using.

[edit] I found some discussions about this online. It is apparently something related to the BASH shell and with MacOS 15.7. Restarting the terminal app after login is a simple workaround. I guess I’ll eventually switch over to zsh, which also fixes the problem. Permission Denied to Temp folder on MacOS after upgrade to MacOS 15.7 · Issue #8690 · google-gemini/gemini-cli · GitHub