macOS popup a dialog "Allow App to find devices on local networks?" to ask Local Network permission. I would like to analyze when it popup and how it impacts my app user scenario. But this dialog only popup when Local Network privacy list not contain this app, once user pressed allow / don't allow, it won't popup again.
System Settings UI does not support removing Local Network permission, so I tried this command but not working.
tccutil reset All
There is also a post mentions that it does not work:
https://developer.apple.com/forums/thread/757949
Is there a way to remove this privacy settings? I don't want to reinstall macOS to test it.
Post
Replies
Boosts
Views
Activity
I'm working on a macOS app. Due to security requirement, I add the following line in XCode other linker flags:
-Wl,-sectcreate,__RESTRICT,__restrict,/dev/null
But after testing, we found that app crashed at launch if system integrity protection disabled. Here is the report:
System Integrity Protection: disabled
Crashed Thread: 0
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/MyLib.framework/Versions/A/MyLib
Referenced from: <845E83E4-9526-36F0-8A2D-ADD407697F4D> /Applications/MyApp/MyApp.app/Contents/MacOS/MyApp
Reason: tried: '/System/Library/Frameworks/MyLib.framework/Versions/A/MyLib' (no such file, not in dyld cache), (security policy does not allow @ path expansion)
(terminated at launch; ignore backtrace)
Thread 0 Crashed:
0 dyld 0x185f3a55c __abort_with_payload + 8
1 dyld 0x185f46b10 abort_with_payload_wrapper_internal + 104
2 dyld 0x185f46b44 abort_with_payload + 16
3 dyld 0x185ecd584 dyld4::halt(char const*, dyld4::StructuredError const*) + 304
4 dyld 0x185eca254 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3884
5 dyld 0x185ec8edc start + 1844
Looks like dyld can't load rpath if restrict segment exist & SIP disabled. Is there a way to fix it? The framework & dylib files needs to be in the bundle to avoid other app using them, so point to /usr/lib is not an option.
Thanks.
I'm working on a macOS background app which hide mouse cursor for all apps. I use eventTap to listen keystroke, then call CGDisplayHideCursor and SetsCursorInBackground trick to hide cursor when specific key is down. It works on most case, except one - when mouse hover on dock.
I'm not sure why mouse cursor can't be hidden when over dock, maybe some kind of elevated privilege? Is there a way to hide it?
Thanks.
Hi,
I'm developing an app that saved some passwords in login keychain. There is a requirement that we need to provide an IT tool to help management. One of the IT tool feature is regenerate the app keychain passwords of ALL users.
The IT tool is designed to run as root, so permission is not a problem. I studied keychain API and found this is most likely one:
OSStatus SecKeychainOpen(const char *pathName, SecKeychainRef _Nullable *keychain);
But it is deprecated from 10.10. The app is designed to on macOS 11 - 14.
What is the proper way to access login keychain of all users as root? Thanks.
Hi,
I submitted a TSI case related to CGEvent, got reply after 3 days. Tested the solution written in mail, but it was not working. Then I replied with a sample project with mail, never heard any response until now. It have been two weeks.
This is my first time using TSI, I don't know whether reply with mail is right, as I didn't receive any automatic response after sent mail. I checked account page, it listed my TSI as "Used", but there is no way to check whether the follow-up mail is received.
Where can I check TSI case is processing or not? My case number is 3751198.
Thanks.
Hi,
I'm on MacBook Pro M2, macOS 13.3.1. I'm writing a feature that need to run before login. After some research I found PreLoginAgents sample code:
https://developer.apple.com/library/archive/samplecode/PreLoginAgents/Introduction/Intro.html
Followed README, installed pre-built agent and SSH to Macbook, then run:
sudo syslog -c 0 -i
syslog -w
volia! SSH prints agent log, it is working.
But if I build code with XCode, there is no log. I tried following changes with no luck:
change LogManager acl log to os_log_info(OS_LOG_DEFAULT, "%s", [str UTF8String]), no log
change to syslog(LOG_INFO, "%s", [str UTF8String]), has log!
But change min deploy target from 10.9 to 11.0, syslog print no log
What is the proper way to print PreLoginAgents log?
Thanks!
Hi all:
I have a macOS application which capture mouse events:
CGEventMask eventMask = CGEventMaskBit(kCGEventMouseMoved) |
CGEventMaskBit(kCGEventLeftMouseUp) |
CGEventMaskBit(kCGEventLeftMouseDown) |
CGEventMaskBit(kCGEventRightMouseUp) |
CGEventMaskBit(kCGEventRightMouseDown) |
CGEventMaskBit(kCGEventOtherMouseUp) |
CGEventMaskBit(kCGEventOtherMouseDown) |
CGEventMaskBit(kCGEventScrollWheel) |
CGEventMaskBit(kCGEventLeftMouseDragged) |
CGEventMaskBit(kCGEventRightMouseDragged) |
CGEventMaskBit(kCGEventOtherMouseDragged);
_eventTap = CGEventTapCreate(kCGHIDEventTap,
kCGHeadInsertEventTap,
kCGEventTapOptionDefault,
eventMask,
&MouseCallback,
nil);
_runLoopRef = CFRunLoopGetMain();
_runLoopSourceRef = CFMachPortCreateRunLoopSource(NULL, _eventTap, 0);
CFRunLoopAddSource(_runLoopRef, _runLoopSourceRef, kCFRunLoopCommonModes);
CGEventTapEnable(_eventTap, true);
CGEventRef MouseCallback(CGEventTapProxy proxy,
CGEventType type,
CGEventRef event,
void *refcon) {
NSLog(@"Mouse event: %d", type);
return event;
}
This mouse logger need accessibility privilege granted in Privacy & Security. But I found that if accessibility turned off while CGEventTap is running, left & right click are blocked, unless restart macOS.
Although replace kCGEventTapOptionDefault to kCGEventTapOptionListenOnly can fix this issue, but I have other feature which require kCGEventTapOptionDefault.
So I try to detect accessibility is disabled and remove CGEventTap:
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(didToggleAccessStatus:)
name:@"com.apple.accessibility.api"
object:nil
suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
}
However, the notification won't be sent if user didn't turn off accessibility but removed it from list. Worse, AXIsProcessTrusted() continues to return true.
Is there a way to fix mouse blocked, or detect accessibility removed?
Thanks!