Jul 192013
 

Think about the following rather unusual scenario: You own a current generation MacBook Air and a new iMac that you don’t use. This blog post will show you how you can use the iMac as a pure monitor without any manual intervention.

Introduction

The current generation iMacs (21″ and 27″) can be used as a Thunderbolt display using Target Display Mode. To enabled this mode you have to boot both Macs and connect them using a Thunderbolt cable. After that you have to press [Command]+[F2] on the keyboard of the “display” iMac. Although this feature is great for rare usage – it’s not very comfortable if you want to use the iMac as a permanent secondary display.

iMacMonitor

thunderbolt-logoTo solve this problem I created iMacMonitor. It’s a small application running on the “display” iMac that monitors the Thunderbolt bus and automatically switches to Target Display Mode if necessary. Thereby one only has to connect the main computer to the Thunderbolt cable and a few seconds later the iMac can be used as a secondary monitor. This works because Mac’s wake from standby if a Thunderbolt device is connected. As soon as the main computer is disconnected the display will sleep again. Be aware that you should not shutdown the “display” computer as it won’t switch to Target Display Mode anymore.

Setup

  1. First you have to download iMacMonitor.app on the “display” iMac and set it as Login Item.
  2. Then make sure that a user is automatically logged in (see this link).
  3. Restart
  4. Voilà

Now you can connect a Thunderbolt enabled Mac and the “display” iMac will switch to Target Display Mode automatically.

Sourcecode

As I have written this application for fun you can also download the Xcode project. It’s released under the MIT licence.

Update: Here’s the Xcode 5 Project for 10.9

  42 Responses to “OS X: How to use an iMac as Monitor”

  1. Florian, I love iMacMonitor. It took me over a year of various search terms to FIND it, but I finally did and it works.

    Thanks for this.

  2. So I understand that you need to connect a physical keyboard to the display mac in order to get the keystroke work. I bet there is a workaround with a virtual keyboard which you can find on any Mac using accessibility. I don’t know much about this, but maybe this is the right direction.
    I just don’t want to connect a physical keyboard to my display mac just in order to let it accept a keyboard shortcut in an application.

  3. For future versions, is it possible to allow the MacBook to access the iMac’s ports? (e.g. ethernet, USB, etc…)

    So that the iMac mimics more closely the behaviour of the Apple Thunderbolt display.

    • Hi Phillip,

      Unfortunately this is impossible as the underlying hardware simply does not support this mode of operation.

  4. This was pretty easy to get up and running, thanks!

    The only problem is that it only works if there is an apple keyboard attached to the imac, and my only reason for using an app like this is so I can free up my apple keyboard.. so no dice unfortunately.

    • Didn’t know that you need a keyboard attached but it makes sense as this tool simulates keystrokes… Anyway, thanks for the post!

    • i’m having the same problem. if the apple keyboard is turned on and connected, this app works as described. but what’s the point? If the keyboard is connecting i might as well toggle it with the keyboard rather than this app.

      • The point is that you only have to connect your main computer using Thunderbolt to the display iMac – everything else is handled automatically. For me it’s not a big deal to connect a second keyboard that’s only function is to be connected to the display iMac.

        However, if that’s a problem for your workflow please feel free to adapt the attached sourcecode.

  5. Hey, I have added this to github for convenience sake and for my own planned updates to the project. Please check it out at github.com/lsd/iMacMonitor

    If there’s an official repo I can fork that instead. Anyway, thanks for this!

  6. Just a data point – this doesn’t work for me. While the iMac is a mid-2011 running 10.8, the keyboard I have is some even more ancient thing that can’t itself cause the computer to enter TDM. I don’t if that has anything to do with it.

  7. What’s the point of the full screen window? Is that because in your setup your iMac is a permanent monitor and it just looks nice, or is there a technical reason? In my setup the iMac is “home computer” and the laptop is “work computer”. Ideally, iMac Monitor to could run without a UI and just silently switch over when I plug into Thunderbolt. I am going to look into combining this with the blueutil source I think. Just wanted to know if there’s a technical reason for the window. (I’m primarily an iOS developer, so new to some of the desktop specifics)

  8. Hello, I am looking at using this app but am wondering if it works if a Mini Display cable is plugged into the Thunderbolt port rather than using a Thunderbolt Cable. I ask because my iMac is an older one from 2009…

    • Hi Fred,

      That’s a very good question! I really don’t know, however I think it will not work!
      It would be really cool if you could try it and update us with your findings.

      • Well so far I’d say it’s a bust. I set iMac Monitor to start on a new user account I created called Target Display (so original I know) and the first time I plugged it the mini display cable in it shifted to Target Display mode and then about 1 second later right back out of it again…

        • Hi Fred,

          Too bad it didn’t work… If you find a solution it would be cool if you keep us updated!

  9. Does this work in Mavericks? I just tried it and it sits there as a black screen with an Apple logo. I tried rebooting, plugging and unplugging the Thunderbolt cable? I wish this worked as it is exactly what I have been looking for?

    Thanks

  10. “Be aware that you should not shutdown the “display” computer as it won’t switch to Target Display Mode anymore.”

    Can you clarify what this means? The app sounds interesting but I want to make sure I understand how it works.

    • Hi,
      If you completely turn off (shutdown) your “display” it won’t switch on when you connect your Mac.
      It has to be running or in sleep mode.

  11. Hi, the Xcode project uploaded has a missing base SDK, any chance you can fix it? I would like to recompile it without the full screen, love what it does apart from that.

  12. Is it possible to turn of the sleep mode in the app?

    because the two imacs i have are always connected with a thunderbolt cable, and the (extended screen imac) doesn’t wake up when i turn my other imac on.

    • Hi Ravi,
      This is a known problem with this app. I haven’t found a workaround yet. The easiest workaround is to attach a mount to your monitor iMac

  13. For anyone wanting to use this…I had to have a Apple keyboard plugged in or it would not work. Other than that it works great 🙂 Thanks florian!

  14. Maybe it could be integrated with “blueutil” in some way? http://www.frederikseiffert.de/blueutil/

    • Hi,

      Yes it COULD be integrated! However I’m currently very busy and unable to do it! Are you interested?

    • How were thinking about integrating this? I’m having trouble getting this work. I’m seeing comments like “I had to have a Apple keyboard plugged in” and I only have an Apple bluetooth keyboard hooked up to my iMac. Would enabling bluetooth on sleep somehow avoid the issue I might be running into? If so, I’d be happy to take a crack at it.

      • Hi,

        I think having a Bluetooth keyboard connected to the monitor iMac is enough to simulate the necessary keystrokes. Without a keyboard the “monitor” might not switch to display mode.

  15. Is there a setting that allows sharing of bluetooth devices for you app? I would like to use the magic mouse for both without having to toggle bluetooth on and off. Thanks for your good work.

    • Hi,

      No, there is no such setting! My customer is using two separate keyboards – maybe that works for you too?

  16. Is the restart necessary? I simply ran the application (on a Mid-2011) and it didn’t detect respond to the plugging in a laptop.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)