Skip to content

Instantly share code, notes, and snippets.

Last active June 14, 2022 02:02
Show Gist options
  • Save zhuowei/5711502ec43141839e6e0ff8c0d9c90d to your computer and use it in GitHub Desktop.
Save zhuowei/5711502ec43141839e6e0ff8c0d9c90d to your computer and use it in GitHub Desktop.

For enabling Universal Control on older Macs, there are three ways.

(All of these requires you to enable the feature flag and disable SIP)

(I haven't tried this but it looks like it'd work)

clang -o liboverride_model.dylib override_model.c -framework IOKit -framework CoreFoundation -shared
sudo launchctl debug gui/$UID/ --environment DYLD_INSERT_LIBRARIES="/Users/zhuowei/liboverride_model.dylib"
launchctl stop
launchctl start
  • use lldb:
sudo launchctl debug gui/$UID/ --start-suspended
launchctl stop
launchctl start
lldb -n UniversalControl
b PlatformModelIsSupported
thread return 1
thread return 1
#include <IOKit/IOKitLib.h>
#define DYLD_INTERPOSE(_replacement,_replacee) \
__attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee \
__attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee }
CFTypeRef hook_IORegistryEntryCreateCFProperty(io_registry_entry_t entry, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options) {
if (CFEqual(key, CFSTR("model"))) {
return CFSTR("MacBookPro17,1");
return IORegistryEntryCreateCFProperty(entry, key, allocator, options);
DYLD_INTERPOSE(hook_IORegistryEntryCreateCFProperty, IORegistryEntryCreateCFProperty);
Copy link

zhuowei commented Sep 2, 2021

opening the Displays prefpane no advanced tab is shown.

I didn't override the check for the Display pane with the dylib method (it's an XPC service and I don't know how to inject code into them). You'll have to connect either by moving your mouse to the side or using the Display panel from a supported computer.

The Kext linked in the other gist would probably work for that, although I haven't tested it. Using lldb to attach to the XPC service also works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment