How can I change change screen resolution using AppleScript? If AppleScript can't do it, what about Terminal?

I tried with examples at How to set screen resolution with a keyboard shortcut on Retina MBP?, but they don't work anymore. I'm on MacBookPro Retina.

This is how the script definitively should start:

    tell application "System Preferences"
        reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
    end tell
    tell application "System Events"
        tell application process "System Preferences"
          -- insert magic
        end tell
    end tell

Now I just need to click on "Scaled" and select different display resolutions, but I don't know how these buttons are "called".


Don't know if still works on current versions of OS X, but somebody wrote a command line tool to get and set resolutions a few years ago: https://github.com/jhford/screenresolution

  • thank you! Although it still works, it doesn't work well. 1440x900 look completely different when set using Displays. Im guessing Retinas weren't around when this was created. – sanjihan May 3 '16 at 19:04
  • I wrote a similar lightweight command line tool (installable via Homebrew) that does support retina screens: github.com/jakehilborn/displayplacer – Jake Hilborn Apr 7 '19 at 17:57

We have created a python script, called Display Manager that allows you programmatically set resolution, bit depth, underscan, mirroring, etc.

Give it a try and let us know if you want additional functionality


  • 1
    Worked for me! I created a Workflow using Automator and assigned a keyboard shortcut via System Preferences > Keyboard > Shortcuts. – rinogo Jun 3 '20 at 1:01
  • 1
    (My command for 1920x1080 @60 fps: /path/to/display_manager.py res 1920 1080 60) – rinogo Jun 3 '20 at 1:06

I've included two scripts in this post for making the display resolution higher or lower. Taking it one step further, I also included the process of assigning keyboard shortcuts.

Changing display resolution with AppleScript


I was fiddling a round this for a while and I've found a simpler way to set the desired resolution. There is a tool displayplacer that let's you save and restore the current display settings.

displayplacer "id:56A96CFC-7F21-168E-3D19-FC1626C9B248 res:2560x1440 hz:60 color_depth:8 scaling:on origin:(0,0) degree:0"

To get the current settings of your displays run displayplacer list it will output a displayplacer command that can be use to restore the current settings. Here is how I'm setting my display to '2560x1440'

This gif shows nicely displayplacer features:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .