You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-5Lines changed: 27 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
1
# TargetDisplayModeTools
2
-
This is a repo with some tools and notes on Apple's Target Display Mode for 2009-2011-era iMacs.
2
+
These are some tools and notes on Apple's Target Display Mode for 2009-2011-era iMacs.
3
+
3
4
A few years ago during COVID lockdown I purchased a broken 27" 2011 iMac to use as a cheap external monitor and made a few notes along the way. Key discoveries:
4
5
- Newer Macs can use these iMacs as external displays when connected via appropriate Thunderbolt cables/adapters
5
6
- Target Display Mode works on macOS 10.13 High Sierra (the latest supported by these iMacs) by copying the binary `/usr/libexec/dpd` from a 10.9 Mavericks installer.
6
7
- Target Display Mode is handled by the motherboard and doesn't need a working GPU (handy since failure of the Radeon 6xx0M series GPUs in these iMacs is common)
7
8
- Target Display Mode can be activated over SSH using the Karabiner VirtualHIDDevice kext (`cmdf2` code in this repo) so no keyboard or mouse is needed
9
+
8
10
Hopefully sharing these notes will keep a few more 27" iMacs from being thrown out.
9
11
10
12
## Repo contents
@@ -17,55 +19,75 @@ Hopefully sharing these notes will keep a few more 27" iMacs from being thrown o
17
19
- If GPU is faulty, move graphics kexts out of `/System/Library/Extensions` and rebuild kext cache (more details below). Probably need to disable SIP. Graphics and VNC screen sharing will be slow.
18
20
- Connect to network and install updates, enable SSH and VNC access for admin user
19
21
- Replace `/usr/libexec/dpd` with version from latest Mavericks installer (more details below)
20
-
- If hard drive is missing, install smcFanControl and add launchd job to limit fan speed (more details below)
22
+
- If hard drive is missing, install smcFanControl and add `launchd` job to limit fan speed (more details below)
21
23
- Success!
22
24
23
25
## Problems and solutions
24
26
25
27
### Booting macOS when the GPU is faulty
26
-
*Problem*: 2011 27” iMac boots to grey screen after progress bar completes
28
+
*Symptom*: 2011 27” iMac boots to grey screen after progress bar completes
29
+
27
30
*Cause*: faulty AMD Radeon card, common issue with machines of this era
31
+
28
32
*Workaround*: Move `ATIRadeonX3000.kext` and `ATI6000Controller.kext` (AMD… in later MacOS) from `/System/Library/Extensions` to e.g. `/System/Library/DisabledExtensions`. In later versions of macOS with a kext cache run `touch /System/Library/Extensions` to force a cache rebuild.
29
33
- Some sites suggest moving all ATI* or AMD* kexts but this doesn’t appear to be necessary
30
34
- Some sites suggest changing nvram `boot-args` to `agc=0` or `agc=-1` but this also doesn’t appear to do anything on an iMac (might be relevant to MBP graphics switching)
31
35
36
+
### Disabling SIP when GPU is faulty
32
37
*Problem*: Can’t move kexts while SIP is enabled, can’t disable SIP since Recovery Partition is inaccessible due to attempting to load above kexts
38
+
33
39
*Solution A*: Boot into single-user recovery mode by holding Option, then pressing Cmd-S immediately after selecting the recovery partition. Couldn’t get this working with the 10.13.6 recovery partition, so may need to use an older recovery partition (e.g. 10.11.6). Run `csrutil disable` from single-user-recovery mode. See also <https://apple.stackexchange.com/questions/332587/single-user-recovery-mode-on-high-sierra-10-13-6>
40
+
34
41
*Solution B*: Plug boot media into another Mac and move kexts from there (or maybe Target Disk Mode)
42
+
35
43
*Possible solution*: (not tried) disable SIP directly using the nvram command from single-user mode using an older pre-SIP macOS (e.g. 10.6.8): `nvram csr-active-config="w%00%00%00"`
36
44
37
45
### Getting Target Display Mode to work on macOS 10.13 High Sierra
38
46
*Problem*: Target Display Mode will not start. Console contains repeated messages every 10 seconds:
39
47
`com.apple.xpc.launchd[1] (com.apple.dpd[182]): Service exited with abnormal code: 75`
48
+
40
49
*Cause*: Target Display Mode is toggled by `com.apple.dpd` (a single binary located at `/usr/libexec/dpd`) which listens for the Cmd-F2 sequence. dpd is repeatedly crashing which means TDM cannot be triggered.
50
+
41
51
*Solution*: The issue seems to just affect `dpd` binaries from 10.10 Yosemite onwards (tested on 10.10.5, 10.11.6, 10.13.6 `dpd`). Replacing the later `dpd` binary with the 10.9.5 Mavericks `dpd` (MD5: `6355f7378348de906ad1ace46c936c8c`) resolves the issue. This can be directly extracted by mounting the Mavericks installer PKG with `hdiutil attach` and opening `/Packages/BSD.pkg` in e.g. Suspicious Package.
42
52
43
53
### Triggering Target Display Mode without a physical keyboard or mouse
44
54
*Problem*: Want to remotely toggle Target Display Mode over SSH.
55
+
45
56
*Solution*: Install [Karabiner Elements](https://karabiner-elements.pqrs.org), which includes a compiled and signed kext for [Karabiner-VirtualHIDDevice](https://github.com/pqrs-org/Karabiner-VirtualHIDDevice-archived). Compile `cmdf2` code in this repo (based on `Karabiner-VirtualHIDDevice/example/virtual_keyboard_example`) and run as sudo over SSH to trigger TDM.
46
57
Use `modifier::left_command` followed by `kHIDUsage_Csmr_DisplayBrightnessIncrement`.
47
58
`AppleVendorKeyboard_Brightness_Up` doesn’t work for some reason.
*Possible solution*: Remap keys with `hidutil` and `launchd` as per <https://rakhesh.com/mac/using-hidutil-to-map-macos-keyboard-keys/> and <https://hidutil-generator.netlify.app>
68
+
54
69
*Almost solution*: `osascript` over SSH works on macOS 10.6.8 (apparently up to 10.9.5 according to above link): `osascript -e 'tell application "System Events" to key code 144 using command down'`. Confirmed not working on 10.13.6 despite enabling Accessibility access for Terminal and Script Editor. <https://apple.stackexchange.com/questions/362787/automator-and-or-applescript-to-automatically-command-f2-to-enter-target-display>
70
+
55
71
*Almost solution*: [VirtualKVM](https://github.com/duanefields/VirtualKVM) seems like it might work for those that want TDM triggered upon attach/detach of Thunderbolt between their MacBook and iMac (along with simultaneous enable/disable of Bluetooth to facilitate transfer of mouse/keyboard control) and don’t mind a helper app running on both devices. However, couldn’t get it to work, possibly due to network issues blocking client-host connection or possibly due to daisy-chaining my iMac off an Apple Thunderbolt Display (MBP connects to TBD).
72
+
56
73
*Almost solution*: <https://github.com/BlueM/cliclick> - didn’t work over SSH, tried Cmd with F2, brightness, etc.
57
74
58
75
### Reducing fan speed when iMac hard drive is removed
59
76
*Problem*: iMac HDD fan runs loudly all the time with no hard drive
77
+
60
78
*Cause*: Apple hard drives contain a built-in temperature sensor which is now absent, so the SMC runs the fan at maximum to be safe.
79
+
61
80
*Solution*: Install [smcFanControl](https://www.eidac.de). Set the maximum HDD fan speed using the `smc` tool within using a `launchd` script (here as `com.local.LimitHDDFan.plist`).
Problem: Want to track iMac temperatures over SSH to avoid overheating with the fan turned down
68
-
Solution: Install [HardwareMonitor](https://www.bresink.com/osx/HardwareMonitor.html) and use command-line tool: `/Applications/HardwareMonitor.app/Contents/MacOS/hwmonitor -c`
87
+
### Monitoring iMac temperature from command line
88
+
*Problem*: Want to track iMac temperatures over SSH to avoid overheating with the fan turned down
89
+
90
+
*Solution*: Install [HardwareMonitor](https://www.bresink.com/osx/HardwareMonitor.html) and use command-line tool: `/Applications/HardwareMonitor.app/Contents/MacOS/hwmonitor -c`
69
91
70
92
### Miscellaneous notes
71
93
-`dpd` has an associated binary `dpaudiothru` responsible for passing through audio which seems to work fine on newer macOS versions.
0 commit comments