macOS 27.2 beta (26B5091g): scripting addition patterns, Dock API changes and patch
Follow-up to #2802 for the 27.2 beta, filed as an issue because pull requests are disabled on this repository.
On macOS 27.2 beta 26B5091g (Apple Silicon) the scripting addition loads into the Dock but does nothing: upstream verify_os_version rejects major version 27, so the payload opens its socket, reports attrib 0x00, and yabai -m space --focus exits 0 without switching. The 27.0 values from #2802 do not help either: none of them (nor the Tahoe patterns) match anything in the 27.2 Dock, as @civiks already reported there.
Dock SHA-256: b4f4fc92e2f8694014dee9538f14f49fa77da3b00e17c344b269c28bbd53cc8a
Patch
Two commits on top of master (dd84572), branch LCS-Dev-Ergos/yabai:fix/macos-27-scripting-addition:
feat(osax): macOS 27 support in the payload tables, version check and client version gates;OSAX_VERSION2.1.31.fix(osax): NULL/nil guards in the space handlers (see "Existing crash" below).
Apply with:
curl -L https://github.com/LCS-Dev-Ergos/yabai/compare/master...fix/macos-27-scripting-addition.patch | git amWhat changed in 27.2
- The Dock is now a fat binary with two arm64e slices:
arm64eandarm64e.x1(cpusubtype0x8000000c, selected on newer chips). The x1 slice starts functions withpacibsppc(FE A7 C1 DA) instead ofpacibsp(7F 23 03 D5), so every pattern anchored on7F 23 03 D5fails there. The function patterns below wildcard the first instruction. -[Spaces currentSpaceForDisplayUUID:]is gone. It was replaced bycurrentSpaceForDisplay:with type encoding@20@0:8I16, i.e. it takes aCGDirectDisplayIDinstead of the uuid string.-[Spaces displayForSPID:](I24@0:8Q16) provides the display id. The payload now falls back to these only when the old selector is missing, so older versions keep their current code path.DPDesktopPictureManagerno longer exists. Wallpaper handling moved toDockCore.WallpaperAgentDesktopPictureManager, which has nomoveSpace:toDisplay:displayUUID:, so moving spaces stays disabled on 27 for now.Spaces._displaySpaces,DockCore.DisplaySpaces._currentSpaceand the SkyLight universal-owner calls are still in the Dock, so focus, create and destroy keep working from there even though the Mission Control UI moved to WindowManager.
Targets
Each one was identified by behaviour rather than by byte similarity, and is unique in both slices:
| target | offset | pattern | arm64e | arm64e.x1 |
|---|---|---|---|---|
dock.spaces |
0x20000 |
?8 ?? ?? ?? 08 ?? ?? 91 00 01 40 F9 E2 03 13 AA ?? ?? ?? 94 ?? ?? ?? ?? 08 |
0x2f5ac |
0x2e92c |
add_space |
0x160000 |
?? ?? ?? ?? E1 03 1E AA ?? ?? ?? 97 FE 03 01 AA FD 7B 05 A9 FD 43 01 91 F3 03 14 AA F5 03 00 AA 96 8E 43 F8 |
0x17a640 |
0x170520 |
remove_space |
0x120000 |
?? ?? ?? ?? FF ?? ?? D1 FC ?? ?? A9 FA ?? ?? A9 F8 ?? ?? A9 F6 ?? ?? A9 F4 ?? ?? A9 FD ?? ?? A9 FD ?? ?? 91 ?? 03 03 AA F5 03 02 AA F4 03 01 AA |
0x12a8e4 |
0x123438 |
animation_time |
0x160000 |
00 10 6A 1E A8 ?? ?? D1 ?? 01 ?? F8 |
0x178f10 |
0x16ee2c |
dppm, move_space, set_front_window |
- | not resolved | - | - |
dock.spaces: the global that receivesclearBindingForBundleID:in the key-binding handler; onlySpacesimplements that selector.add_space:x20is aDisplaySpaces(it loadsspacesat ivar offset0x38); the function counts user spaces and callsCGSMoveManagedSpaceToDisplayIndex.remove_space: takes(space, display_space, dock_spaces, sid, sid)and callsSLSTransactionDestroySpaceandspaceBecameFirst:onDisplay:.animation_time: thefmov d0, #0.25passed to the space-switch transition inDisplaySpaces.set_front_windowis only reached fromscripting_addition_focus_window, which is compiled out (#if 1inwindow_manager_focus_window_with_raise), so it is left unresolved.
SLSGetWindowSubLevel on 27.2 still expects reply id 0x7747, so the Tahoe MIG request id 0x76E3 is correct for 27 as well; the client gates treat 27 like Tahoe.
Testing
Live on 27.2 26B5091g, M1 Pro (arm64e slice): the payload reports attrib 0x4D; space focus works in both directions and keeps the Dock's _currentSpace in sync; creating and destroying a space both work, and the Dock forwards the changes to WindowManager. The arm64e.x1 slice was verified statically only. I could not test 27.0 or 27.1; the offsets were chosen so the 27.0 locations reported in #2802 should still fall inside the scan windows, but uniqueness there is unverified.
Existing crash
While testing, destroying an unknown space id crashed the Dock (EXC_BREAKPOINT, CFEqual() called with NULL first argument in SLSManagedDisplayGetCurrentSpace). do_space_destroy passes the result of SLSCopyManagedDisplayForSpace on without a NULL check, and the other space handlers have the same pattern. yabai validates ids before sending, but a space that disappears between that check and the payload handling it would crash the Dock the same way. The second commit adds the missing guards and is independent of macOS 27.
Source: asmvik/yabai