Paired devices are part of the system settings.
You can find the file with the Bluetooth settings in /Library/Preferences , its name is com.apple.Bluetooth.plist .

However, you cannot edit the file directly. You must use the SCPreferences class from System Configuration .
Please note that the API for accessing / changing system settings is rather low.
EDIT: The following code works if it is run in superuser mode. I myself am not a Mac OS developer, but it can be started using AuthorizationRef and run in user mode (the user will confirm access to the system configuration).
SCPreferencesRef prefs = SCPreferencesCreate(kCFAllocatorDefault, CFSTR("Test"), CFSTR("/Library/Preferences/com.apple.Bluetooth.plist")); const CFStringRef PAIRED_DEVICES_KEY = CFSTR("PairedDevices"); NSArray *pairedDevices = (__bridge NSArray *) SCPreferencesGetValue(prefs, PAIRED_DEVICES_KEY); NSLog(@"Paired devices: %@", pairedDevices); NSString *deviceToRemove = @"e4-32-cb-da-ca-2f"; NSMutableArray *newPairedDevices = [pairedDevices mutableCopy]; [newPairedDevices removeObject:deviceToRemove]; Boolean valueSet = SCPreferencesSetValue(prefs, PAIRED_DEVICES_KEY, (__bridge CFPropertyListRef) [NSArray arrayWithArray:newPairedDevices]); NSLog(@"Value set: %@", (valueSet) ? @"YES" : @"NO"); if (!valueSet) { NSLog(@"Error: %@", SCCopyLastError()); } Boolean saved = SCPreferencesCommitChanges(prefs); if (!saved) { NSLog(@"Error: %@", SCCopyLastError()); } NSLog(@"Saved: %@", (saved) ? @"YES" : @"NO"); CFRelease(prefs);
Sulthan
source share