Post

Replies

Boosts

Views

Activity

Code signing crash when registering login item
I'm getting a code signing crash when I try to register a helper app as a login item, and I think this is new with macOS 13.4. That is, the crash log contains this: Exception Type: EXC_CRASH (SIGKILL (Code Signature Invalid)) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: CODESIGNING 4 Launch Constraint Violation I'm seeing one suspicious message in the system log: tccd Prompting policy for hardened runtime; service: kTCCServiceAppleEvents requires entitlement com.apple.security.automation.apple-events but it is missing for accessing={TCCDProcess: identifier=com.jwwalker.AutoPairs.uiapp, pid=91471, auid=501, euid=501, binary_path=/Applications/AutoPairs 4.0.1a1/AutoPairs4.0.1a1.app/Contents/MacOS/AutoPairs}, requesting={TCCDProcess: identifier=com.apple.appleeventsd, pid=531, auid=55, euid=55, binary_path=/System/Library/CoreServices/appleeventsd}, I can't figure out why the OS would think that I need an Apple Events entitlement. I've looked a the thread Resolving Code Signing Crashes on Launch, but it hasn't enlightened me. One problem I ran into is at the step certtool d "authorised0.cer" I get the output CSSM_CL_CertGetAllFields: CSSMERR_CL_UNKNOWN_FORMAT
3
0
1.7k
May ’23
Sandboxed helper tool crash on launch
When I try to turn on sandboxing on a helper tool, it crashes on launch. I thought my problem was solved when I found the post Sandboxed Helper Tool Crashing in libsystem_secinit, but no. I set CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO in the target that builds the tool, and verified that the only entitlement in the built tool is that com.apple.security.app-sandbox is true, but it still crashes. Backtrace: Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_secinit.dylib 0x7ff81af68400 _libsecinit_appsandbox.cold.7 + 49 1 libsystem_secinit.dylib 0x7ff81af6793c _libsecinit_appsandbox + 1831 2 libsystem_trace.dylib 0x7ff80f06649c _os_activity_initiate_impl + 51 3 libsystem_secinit.dylib 0x7ff81af671d4 _libsecinit_initializer + 67 4 libSystem.B.dylib 0x7ff81af7b8b9 libSystem_initializer + 286 5 dyld 0x7ff80efa1618 invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 172 6 dyld 0x7ff80efe0de9 invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 242 7 dyld 0x7ff80efd4ef7 invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 557 8 dyld 0x7ff80ef870b7 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 245 9 dyld 0x7ff80efd40a7 dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 175 10 dyld 0x7ff80efe08d2 dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 470 11 dyld 0x7ff80efa14f6 dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 150 12 dyld 0x7ff80efa9fd4 dyld4::PrebuiltLoader::runInitializers(dyld4::RuntimeState&) const + 30 13 dyld 0x7ff80efc100d dyld4::APIs::runAllInitializersForMain() + 71 14 dyld 0x7ff80ef8c369 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3743 15 dyld 0x7ff80ef8b281 start + 2289
2
0
1.2k
Mar ’23
How to find culprit when stuck in SecureInput mode?
Sometimes, a Mac gets stuck in secure keyboard input mode, which prevents event taps from working. Googling indicates that this is a perennial intermittent problem. I've seen the suggestion to find the responsible process by using the command line ioreg -l -w 0 | grep SecureInput and looking for a PID in the output. When this happened to me today, the PID was that of the loginwindow process. That seems to be a bogus "I don't really know" result. In my case, quitting Safari cleared the problem. But is there any better way to find out the real source of the problem than quitting apps one by one?
2
0
1.3k
Mar ’23
CGEventTapPostEvent fails in Save panel
I have a keyboard macro utility that uses a global event tap, and requires accessibility permission. It works except when typing in the edit field of a standard Save panel. Then it just beeps when I call CGEventTapPostEvent. I'm guessing that has something to do with standard open/save panels running in some special security box ( I forget the term). If I could just turn off my utility in Save panels, that would be good enough, but I can't figure out how to detect that situation. If I look at the result of CGWindowListCopyWindowInfo, I can see the Save window, but I don't see anything special about it. Nor can I think of any way of detecting that the keyboard event I posted has been rejected.
1
0
919
Feb ’23
NSApplicationActivateAllWindows does not work, any alternative?
According to the documentation of the NSApplicationActivateAllWindows flag of -[NSRunningApplication activateWithOptions:], "all of the application's windows are brought forward". That does not actually happen, and has not since at least macOS 10.15. It did work in macOS 10.13, don't know about 10.14. Is there any reasonable alternative to achieve the same effect?
2
0
874
Jan ’23
Xcode script build phase error involving output file
I have a run script build phase that is trying to do custom code signing of a helper tool after it has been copied into the app package, so I have set both input and output files to the same thing, ${CONFIGURATION_BUILD_DIR}/$CONTENTS_FOLDER_PATH/Helpers/V40SSApp. But when I try to build, I get an error invalid task ('PhaseScriptExecution Run\ Script /mypath/Debug/installer.build/Script-BED5B762297F4C4C00C96242.sh') with mutable output but no other virtual output node I would guess that the "mutable" bit has something to do with the input and output being the same, but I don't get what it's complaining about.
1
2
892
Jan ’23
Why would event tap creation fail?
On my Mac (running Ventura), so long as my app is granted accessibility permission in System Settings > Privacy & Security > Accessibility, I am able to create a global event tap like so: CFMachPortRef thePort = CGEventTapCreate( kCGAnnotatedSessionEventTap, kCGTailAppendEventTap, kCGEventTapOptionDefault, // active filter CGEventMaskBit(kCGEventKeyDown), CTapListener::MyTapCallback, NULL ); But on a user's computer, also running Ventura, the CGEventTapCreate call is apparently returning NULL, even though he's showing me a screen shot of the accessibility permission being turned on. Any ideas what I could be missing, or how to debug it?
0
0
1.1k
Jan ’23
Can defaults command on macOS read app group preferences?
Is there any way to read/write preferences for a Mac app group using the defaults command? I'm talking about the stuff you would programmatically manipulate using [NSUserDefaults initWithSuiteName:], and that is stored on disk in ~/Library/Group Containers. If I just say defaults read <suite name>, it tells me the the domain does not exist.
5
1
2.6k
Jan ’23
How is CGRequestPostEventAccess supposed to work?
I can't find any documentation on CGRequestPostEventAccess or its friend CGRequestListenEventAccess, except for the API declarations in CGEvent.h. The fact that it returns a boolean and doesn't have a completion callback or anything like that suggests that it should be synchronous, i.e., not return until the user has decided to grant or deny permission. Experimentally, that doesn't seem to be the case, but then what does the return value mean?
3
0
1.2k
Nov ’22
Registering login item with new SMAppService API
I'm trying to use -[SMAppService loginItemServiceWithIdentifier:] API, and after creating the SMAppServiceInstance, its status is SMAppServiceStatusNotFound. That means it didn't find the helper app? The documentation is a little mixed up. It says that the parameter is "The bundle identifier of the helper application", but also says "The property list name must correspond to a property list in the calling app’s Contents/Library/LoginItems directory". So which is it, a property list name or a bundle identifier? And it the thing in the LoginItems directory a helper application or a property list? What I have is an app bundle inside the Contents/Library/LoginItems of the app that's calling the SMAppService API. Or in other words, the given bundle identifier parameter is the CFBundleIdentifier value in Caller.app/Contents/Library/LoginItems/Helper.app/Contents/Info.plist. Is that not the right way to do it?
3
0
2k
Nov ’22
Can a system preference pane register a login item in Ventura?
I have a system preference pane that contains a background-only app that it wants to set as a login item. I understand that the proper way to set up login items in Ventura is by using the new SMAppService framework. In order to do so, I need an instance of SMAppService. I can't create it using +[SMAppService loginItemServiceWithIdentifier:], because that assumes that the login item is embedded in the calling app, and in this case the calling app is System Preferences. That leaves having the app itself get the mainAppService class property. But when I do that, and then ask the service for its status, the result is SMAppServiceStatusNotFound. That's documented as: An error occurred and the framework couldn’t find this service. What kind of error??? When I try this, I see some messages in Console from the tccd process that look like they might be related, but they don't clarify what's wrong. Must I just give up on using a system preference pane, and make my utility a plain old app containing a helper app?
1
0
822
Oct ’22