I had an extra iMac 27″ (late 2011) that I wanted to use as a monitor
with my thinkpad that runs linux. This is quite easy to do and involves
something called Target display mode that the iMac can be put into.
I was concerned that this was a Mac-only mode and that it wouldn’t work
There are two computers involved:
thinkpad: drives the imac, runs linux imac 27": works as an external display, has os x installed and an apple keyboard connected to it.
- First visit this page on apple’s website and determine
what kind of connectors are supported in your imac. My thinkpad and
imac both have a mini display port connector. I bought one off
amazon for about \$15.
- Then install the arandr, and autorandr utilities on your linux box.
I use the newer fork of autorandr written in
python. arandr is a gui
that makes things a little easier.
- On the linux box, run the command,
while :; do xrandr | grep '\'; date '+%T'; sleep 2s; done
This should display a messages that shows what monitors are
- Hit command + F2 on your imac to put it into target display mode.
You should see new “connected” messages appearing on your linux box.
At the same time, simultaneously run arandr, and hit activate on
your the arandr menu. This will automatically enable the external
monitor. You only have a window of about 5 seconds from when you hit
command + F2on your imac until you activate the display on your
linux box. The alternative to using arandr is to have a command like
the following entered into a terminal that you’re ready to hit enter
xrandr --output eDP1 --mode 1920x1080 --output DP2-2 --mode 2560x1440
The problem with the latter method is that it requires you to know
the name that your display will be detected as. IN this case, it was
detected as DP2-2. I suppose, a priori, it ought to be possible to
determine what port the monitor is connected to, but I don’t know
This should activate the imac as an external display. Now you want
it to be automatically put into this display setting as soon as it
is detected. This is where the autorandr script and its udev rules
(that detect the external monitor being connected) come into play. I
autorandr -s imac-external
Then if you’re on a systemd based distribution enable the
autorandr.service and start it up with
systemctl start autorandr systemctl enable autorandr
both run as the root user. Make sure you’ve put the appropriate rule
Then reload your udev rules using
udevadm control --reload-rules
Now your imac should be automatically detected and turned on when you 1)
turn on target display mode by hitting
command + F2 and 2) connect
your laptop/desktop to the imac.