MacOS How to install and use this program

catalinacommand linemacosshortcutterminal

I downloaded a command line utility from this github webpage . I clicked on the green Clone or Download button to download the zip file. Although, there are also files that can be downloaded from the releases tab. I'm not sure whether I'm supposed to download those files instead. After downloading and unzipping the zip file, I double-clicked on the file entitled displayplacer, which opened a terminal window that ran a bunch of commands.

Now what? How do I use this program?

I tried opening a new terminal window and running displayplacer list which, according to the github page, is supposed to Show current screen info and possible resolutions. However, the terminal window returned zsh: command not found: displayplacer after I entered the command. Did I not install the code properly?

Ultimately, what I want to do is set up a keyboard shortcut that switches the primary display between my macbook's internal display and my external display. How do I do this?

(macOS catalina)

Best Answer

Installation:

  1. Download the zip to your Downloads folder
  2. Unzip displayplacer-master.zip
  3. Enter in Terminal: sudo mv ~/Downloads/displayplacer-master/displayplacer /usr/local/bin/
  4. sudo chmod +x /usr/local/bin/displayplacer
  5. displayplacer
  6. Depending on your Security & Privacy settings you have to allow execution of the file in System Preferences > Security & Privacy > General

All other files included in the zip won't be required to run the exec.

Usage:

  1. Get the properties of all your displays: displayplacer list
  2. With the properties and the various possible switches create an arrangement. One example with four monitors is listed:

    displayplacer "id:18173D22-3EC6-E735-EEB4-B003BF681F30+F466F621-B5FA-04A0-0800-CFA6C258DECD res:1440x900 scaling:on origin:(0,0) degree:0" "id:4C405A05-8798-553B-3550-F93E7A7722BB res:768x1360 hz:60 color_depth:8 scaling:off origin:(1440,0) degree:90" "id:A46D2F5E-487B-CC69-C588-ECFD519016E5 mode:3 origin:(-1440,0) degree:270"
    

    I have no 2nd screen in my virtual machine so I partly have to guess what it means:

    The first two monitors (1440x900) are mirrored and contain the menubar. The third is on the right and rotated by 90 degrees (clockwise?). The fourth is on the left and rotated by 90 degrees (counterclockwise?).

Automator:

After finding appropriate settings (at least two if you want to switch the primary display between [your] macbook's internal display and [your] external display: back and forth) you have to create two different services/quick actions/etc. each containing one shell script ("Run Shell Script") with the proper displayplacer "id:.... line.

Depending on your Mac hardware and your system version you can apply a shortcut or even add it to the Touch Bar.