How can I set a scaled display resolution from the command-line in macOS Catalina?

Solution 1:

I’m not aware of any way to do this via defaults write (although it seems like it should be possible). I even checked MacPilot which is usually my go-to for hidden defaults.

My suggestion would be to use display_manager.py which is the best command-line tool that I know of which is being actively developed. It is free, but will require you to figure out the proper settings for your computer.

There’s also SwitchResX which is a commercial app ($16, I think) but if all you want it for is the initial setup, that might be overkill.

Last but not least, there’s ‎Display Menu which is free, but with a $2 in-app purchase will add AppleScript support, which means you can use it from the command line.

Solution 2:

I came across this and tried TJ's suggestion display_manager.py The script worked beautifully and even gave me an option to increase the resolution over what System Prefs/Displays was offering.

I downloaded the whole git to my application directory. Then ran:

/Applications/display_manager-stable/display_manager.py show highest

I took the results and I ran this:

/Applications/display_manager-stable/display_manager.py res 1920 1080

I set up a LaunchAgent (using Lingon) with the command above and now when my headless mini restarts I am able to remote in and don't get the default unworkable resolution.

Thanks for this TJ. I had no idea this existed.