Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Enables full/split-screen window modes in the running instance
# (original idea:
# Works by attaching with LLDB to the running instance and
# adding -Primary, -Auxiliary and -AllowsTiling collectionBehavior's to existing windows.
# Note that this is usually impossible due to SIP (System Integrity Protection). One
# workaround is to remove code signature from the Simulator binary.
# 1. Make sure is running
# 2. Run this
# - Follow instructions to work around SIP (once for each Xcode update)
# 3. Notice 'Enter Full Screen' (the right one, green) button is now enabled on the Simulator window title bar
# 4. Long-press it to enter tiling mode
# - Note that the usual way of setting up splits through Mission Control won't work for this window
[ -f $path ] || {
>&2 echo "Invalid simulator path: $path"
exit 1
codesign --display "$path" 2>/dev/null && {
>&2 cat <<-EOF
Simulator binary is code-signed. LLDB won't be able to attach due to System Integrity Protection.
Close Simulator and remove code signature with:
codesign --remove-signature "$path"
exit 2
lldb \
--attach-name Simulator \
--batch \
--one-line "expr ((NSWindow *)[(NSArray *)[[NSApplication sharedApplication] windows] setValue:@(1<<7|1<<8|1<<11) forKey:@\"collectionBehavior\"]);"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment