Skip to content

Instantly share code, notes, and snippets.

@tbartelmess
Last active January 2, 2021 21:56
Show Gist options
  • Save tbartelmess/8f3fd7913e625a52c7928da49336f347 to your computer and use it in GitHub Desktop.
Save tbartelmess/8f3fd7913e625a52c7928da49336f347 to your computer and use it in GitHub Desktop.
Apple Script to Attach Xcode to a Process
--- Usage: osascript [PATH TO SCRIPT] pid
on run argv
tell application "System Events"
tell process "Xcode"
set frontmost to true
click menu item "Attach to Process by PID or Name…" of menu "Debug" of menu bar 1
click first text field of sheet 1 of window 1
keystroke item 1 of argv
click button "Attach" of sheet 1 of window 1
end tell
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment