I've just installed Lazarus 4.0 running under macOS 15.4.1, and I, too, cannot do an IDE rebuild or even build any projects at all. I've just tried my old installation of Lazarus 3.99 which was working fine with the old macOS version, but that, too, fails to build. I've tried downloading and installing the 16.2 version of the Xcode Command Line Tools as well as trying this "solution"...
https://forum.lazarus.freepascal.org/index.php/topic,70698.msg553691.html#msg553691. Nothing works

Has anyone got a reliable fix, or are/am we/I SOL?
* UPDATE *
I take it all back @ChrisR! I modified my `Configure "Build Lazarus"` to contain `-WM10.15` rather than `-WM11.0` which it had before, and the rebuild ran!
I've still got the problem whereby the IDE is not restarting properly. I'm getting this error when the IDE tries to restart...
Can't find the lazarus executable /Applications/lazarus 4.0/lazarus.app/Contents/Resources/startlazarus.app/Contents/MacOS/lazarus
I, therefore, copied the "lazarus" `unix executable` from the main install folder to `/Applications/lazarus 4.0/lazarus.app/Contents/Resources/startlazarus.app/Contents/MacOS` but this resulted in a sort of ghost copy of Lazarus, which, doesn't show up on the Cmd Tab app list, and doesn't allow access to the macOS menu bar. It does, however, show the newly added components.
When I close this ghost copy of Lazarus, and restart Lazarus from my Task bar, I get the normal version, but without the component showing...
Perhaps it will make more sense in the morning 😉