Skip to content

Instantly share code, notes, and snippets.

@swizzlr
Created January 12, 2013 00:14
Show Gist options
  • Select an option

  • Save swizzlr/4515129 to your computer and use it in GitHub Desktop.

Select an option

Save swizzlr/4515129 to your computer and use it in GitHub Desktop.
Change your Retina Mac's screen scale from the Terminal!
#!/bin/bash
#An Applescript embedded in a shell script so I can do this on the command line. Sorry.
#Don't put this on a non retina Mac. Bad Things™ will happen.
#by @tomcatterall/@ares (Twitter/App.net). Say something nice to me if you use and like this, I'd love to know.
echo 'on run argv
try
set theDisplayArgument to item 1 of argv as number
on error
return "
Scaler. Scale your Retina display from the Terminal!
Usage:
1 is Larger Text (hangovers), 5 is More Space (Xcode), 3 is gravy, and there are some numbers in between.
"
end try
if theDisplayArgument < 1 or theDisplayArgument > 5 then
return "Pick a number between 1 and 5."
end if
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.displays"
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
end tell
tell application "System Events"
click radio button "Scaled" of tab group 1 of window "Color LCD" of application process "System Preferences" of application "System Events"
click radio button theDisplayArgument of radio group 1 of group 1 of tab group 1 of window "Color LCD" of application process "System Preferences" of application "System Events"
if theDisplayArgument = 1 then
click button "OK" of sheet 1 of window "Color LCD" of application process "System Preferences" of application "System Events"
end if
end tell
end run'|osascript - $1
@ctsrc
Copy link

ctsrc commented Nov 10, 2019

An Applescript embedded in a shell script so I can do this on the command line. Sorry.

I came across this the other day and I know it's been 7 years since you posted this gist and so you probably don't use this script at all any longer, and you might already know this by now but I just wanted to point out that instead of wrapping your AppleScript in a shell script you can just make the shebang invoke osascript directly, same way that I do in this simple little AppleScripts here: https://github.com/ctsrc/applescripts/blob/cea8ebdedf72989feeb2da378872d154d827bc58/bin/photoshop_save.scpt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment