I assume you based that code on an SO answer from 2011? I believe that Xcode 15 no longer captures
stderr
to show NSLog
entries, and instead gets it from the system log. So you could argue that the output is already going to file...