Can someone explain this message

, it is after update to Xcode 14.3:

[default] CGSWindowShmemCreateWithPort failed on port 0

Post not yet marked as solved Up vote post of macsven Down vote post of macsven
4.1k views
  • I'm seeing the same messages during debug of my objective-c Mac app. This started appearing after some macOS/Xcode update.

Add a Comment

Replies

Update to Xcode 14.3 from which version ?

Is it in a SwiftUI app ?

If so, could you show your app file:

@main
struct MyApp: App {
}

Please give more context.

  • No it is in Objective-C. It is a standard MacApp, no UI Tweaks. Is this a Problem with saving / loading data to NSUserDefaults?

Add a Comment

Happens with my app too on macOS (Ventura 13.3 (22E252), Xcode Version 14.3 (14E222b)). My app is a SwiftUI app.

This is printed in the log every time I close a sheet opened from a View. Doesn't matter if the sheet is closed by pressing a button on view (dismiss() is called) or by pressing esc on keyboard.

App file looks like this, if that matters:

import SwiftUI

@main
struct MyBlahBlahApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
               .environment(\.managedObjectContext, BlahBlahContainer.shared.persistentContainer.viewContext)        
        }
    }
}
  • The same is after updating a NSTableview, or i do a cllick in a NSTableView.

Add a Comment

Yeah, this message constantly popping up during debug is a new normal since Ventura 13.3. Does not seem to affect anything though and things work just fine.

Please see On Log Noise to determine your next steps for these console logs.

The program might be using a deprecated API, such as NSCountWindows which can cause that os_log message to appear in the console.

Try compiling with -Wdeprecated-declarations enabled, and clean up the code that is using deprecated APIs.

Alternatively, in your lldb, you can set a breakpoint (lldb) b libsystem_trace.dylib``_os_log_error_impl (only one backtick; concession to the forum formatting) and when that gets hit you can look up the callstack to figure out what in your code triggered the os_log message.

  • Wow thanks for - (lldb) b libsystem_trace.dylib .... idea. I'm getting the weird CGSWindowShmemCreateWithPort failed on port 0 message, inside an NSAlert() that fails with Sonoma beta and Xcode 14 and 15. NSAlert fails. The buttons won't turn blue. No idea what it is though.

  • Thanks for that breakpoint command too, see my solution below.

Add a Comment

I'm facing the same messages during debug of my swift Mac app which use the storyboard. I would like to know if anyone solved it ?

my game just started doing this on the newest xcode beta

I had this, caused by this:

NrofWindows = [[NSWindow windowNumbersWithOptions:NSWindowNumberListAllApplications|NSWindowNumberListAllSpaces] count];

Doc says: "If you pass 0 instead, then the list the method returns contains window numbers for visible windows on the active space belonging to the calling application"

As that is what I actually need, changed the value to 0:

NrofWindows = [[NSWindow windowNumbersWithOptions:0] count];

And the log msg vanished.

Thanks Eljay Adobe for the breakpoint command.

rick