Skip to content

Instantly share code, notes, and snippets.

@macsimom
Last active September 25, 2026 23:46
Show Gist options
  • Select an option

  • Save macsimom/f8758a9d3d65e71a96a102c288d7ff28 to your computer and use it in GitHub Desktop.

Select an option

Save macsimom/f8758a9d3d65e71a96a102c288d7ff28 to your computer and use it in GitHub Desktop.
Boot a factory fresh macOS 27 Golden Gate machine in recovery and run the following to enable Screen Sharing / Remote Management so you can screen record the entire setup process from "Hello" to MDM enrollment and user creation via Screen Sharing on another Mac.
#!/bin/bash
# version 1.0, 2026 simonandersen
# enable screensharing in launchd context so it autostarts on boot
/usr/libexec/PlistBuddy -c "Add :com.apple.screensharing bool NO" /Volumes/Macintosh\ HD/private/var/db/com.apple.xpc.launchd/disabled.plist
# flag screensharing as Remote Management instead of regular Screen Sharing
touch "/Volumes/Macintosh HD/Library/Application Support/Apple/Remote Desktop/RemoteManagement.launchd"
# Allow ARD to observe and control the screen
# Note: You'll have to have booted to the beginning of the Setup Assistant at least once after activation in order to have the TCC.db initialized
/Volumes/Macintosh\ HD/usr/bin/sqlite3 /Volumes/Macintosh\ HD/Library/Application\ Support/com.apple.TCC/TCC.db <<'EOSQL'
INSERT INTO access VALUES('kTCCServicePostEvent','com.apple.screensharing.agent',0,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1763938238,NULL,NULL,'UNUSED',1763938238,NULL,0);
INSERT INTO access VALUES('kTCCServiceScreenCapture','com.apple.screensharing.agent',0,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1763938238,NULL,NULL,'UNUSED',1763938238,NULL,0);
EOSQL
# Add a _musetupuser
# it has naprivs set to all the ARD privileges
cat <<'EOF' > /Volumes/Macintosh\ HD/private/var/db/dslocal/nodes/Default/users/_musetupuser.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IsHidden</key>
<array>
<string>YES</string>
</array>
<key>_writers_passwd</key>
<array>
<string>_musetupuser</string>
</array>
<key>authentication_authority</key>
<array>
</array>
<key>generateduid</key>
<array>
<string>FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000FA</string>
</array>
<key>gid</key>
<array>
<string>20</string>
</array>
<key>home</key>
<array>
<string>/var/setup</string>
</array>
<key>name</key>
<array>
<string>_musetupuser</string>
</array>
<key>passwd</key>
<array>
<string>*</string>
</array>
<key>realname</key>
<array>
<string>Mirror Universe Setup User</string>
</array>
<key>record_daemon_version</key>
<array>
<string>10030000</string>
</array>
<key>shell</key>
<array>
<string>/bin/bash</string>
</array>
<key>uid</key>
<array>
<string>250</string>
</array>
<key>naprivs</key>
<array>
<string>-1073741569</string>
</array>
</dict>
</plist>
EOF
# Set a password for the _musetupuser so that we can connect to Screen Sharing
# The password is nosecret
dscl -plist -f /Volumes/Macintosh\ HD/private/var/db/dslocal/nodes/Default localhost -passwd /Local/Target/Users/_musetupuser nosecret
# Add the _musetupuser to the admin group because it's nice to have
dscl -f /Volumes/Macintosh\ HD/private/var/db/dslocal/nodes/Default localhost -append /Local/Target/Groups/admin GroupMembers FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000FA
dscl -f /Volumes/Macintosh\ HD/private/var/db/dslocal/nodes/Default localhost -append /Local/Target/Groups/admin GroupMembership _musetupuser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment