Python script to automatically start Target Display Mode when connecting a Thunderbolt cable to your iMac or MacBook
AutoTDM will automatically start Target Display Mode when connecting a Thunderbolt cable to your iMac or MacBook. Works when devices have gone to sleep and when you reboot your iMac host.
The script polls your network interfaces and checks for when an established Thunderbolt bridge connection is assigned an IP. It then fires off the CMD+F2 keyboard command to your host machine (iMac) to start the Target Display Mode.
Place thunderbolt_TDM.py and thunderbolt_TDM.command in your home directory
python ~/thunderbolt_TDM.py
If you want to have the script execute on iMac startup, add the shell file to your start up list: