Last active
August 7, 2024 10:29
-
-
Save kineticac/ca2d2c2b071c564abc78d8d67f0f0e4f to your computer and use it in GitHub Desktop.
Using iMac as a target display for MacBook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do shell script "ssh username@IPaddress '~/Dropbox/code/target-display/targetdisplay.sh'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script lives on the machine that will be used as the Target Display. | |
# Tested on a 2012 iMac running Catalina, and theoretically should work on other | |
# machines. | |
# This script is basically sending the Command + F2 (or Command + Fn + F2) keypress | |
# that will send the Target Display machine into a target display mode. Helpful | |
# if you don't have an Apple keyboard attached, or want to execute Target Display | |
# from another machine via SSH, such as in the following scripts in this gist. | |
osascript -e 'tell application "System Events" to key code 144 using command down' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setup
SSH Access on Target Display machine
~/.ssh/id_dsa.pub
. If not, in the local machine's terminal, runssh-keygen
, and do not password protect it, just hit enter when it prompts you (this is slightly not as safe, so if someone gets access to it somehow, they can access your keys without a password, but with a password, you'll be prompted everytime and the AppleScript won't work).cat ~/.ssh/id_dsa.pub | ssh user@remotehost 'cat >> ~/.ssh/authorized_keys'
, only this time you will be prompted for your ssh password from step 2.remotehost
is the IP address on our local machine.ssh user@remotehost