Skip to content

Instantly share code, notes, and snippets.

@chuckg
Last active August 29, 2015 14:17
Show Gist options
  • Save chuckg/4a83fe0f37a3d8c69044 to your computer and use it in GitHub Desktop.
Save chuckg/4a83fe0f37a3d8c69044 to your computer and use it in GitHub Desktop.
Install OSX command line tools (sudo password required)
  • Open AppleScript
  • Paste the xcode-select-install.osa script into the edit.
  • Save the file as xcode-select-install.app, select "Application" from the "File Format" option.

It's important the app is saved with exact name specified or it won't be able to skip the accessibility confirmation when run.

Seeing LSOpenURLsWithRole() failed with error -10810 for the file /var/tmp/xcode-select-install.app? Run: command "chmod +x xcode-select-install.app/Contents/MacOS/applet"

# See current: sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "SELECT * from access"
# Reset all: tccutil reset Accessibility
# Allow assistive device access for this app.
do shell script "sudo sqlite3 /Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT or REPLACE INTO access VALUES('kTCCServiceAccessibility','com.apple.ScriptEditor.id.xcode-select-install',0,1,1,NULL)\"" with administrator privileges
do shell script "xcode-select --install"
do shell script "sleep 1"
tell application "System Events"
tell process "Install Command Line Developer Tools"
keystroke return
click button "Agree" of window "License Agreement"
end tell
end tell
# Remove assistive device access for this app.
do shell script "sudo sqlite3 /Library/Application\\ Support/com.apple.TCC/TCC.db \"DELETE from access where client='com.apple.ScriptEditor.id.xcode-select-install'\"" with administrator privileges
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment