marionuevo

· Software, Linux

Linux on an iMac 5K: the SMC won't protect your RAM

Apple left my 2014 iMac behind; Linux gave it a second life. Then it shut itself down. It wasn't the CPU or the GPU: it was the memory, and nothing was watching it. Along the way I found that on this iMac a terminal that draws on the GPU is far better.

A second life

Apple stopped updating this iMac with macOS Big Sur. The hardware still works perfectly, and the 5K panel is as good as many sold today, but without updates the machine slowly becomes unusable: no security patches, and apps that drop support one by one. That's the path Apple wants, the one that ends with buying a new computer.

Linux offers another path. Omarchy, like Linux in general, runs a current, maintained system on hardware that is still fully functional. It gives a machine like this a second life instead of sending it to a drawer or a landfill. This article is about the one thing that didn't come for free: what macOS was quietly doing for the hardware, and what I had to do myself.

The shutdown

I run Omarchy on a late-2014 Retina 5K iMac (iMac15,1: i5-4690, Radeon R9 M290X, 24 GB of DDR3L). Among other things it works as a 5K second display for my other computers, which means redrawing 14.7 million pixels nonstop.

With mbpfan, the usual fan control for Macs on Linux, the fan only follows the CPU temperature. Showing full-screen video, the CPU and GPU stayed under 60°C and the fan near its floor, while one of the SMC's probes (the SMC is Apple's controller for the fan and the sensors) kept climbing. Until the SMC powered the iMac off.

What TM1a is

The probe that kept climbing is called TM1a. Apple doesn't document what each probe measures, and the board's schematic (820-4652-A) isn't freely available anywhere, so I worked it out by elimination: one load at a time, with the other sensors as a reference.

LoadTM1aCPUGPU
RAM (stress-ng --stream, 90 s)51.5 → 90.5°C+5°C—
CPU (stress-ng --cpu, 4 min)+2°C46 → 54.5°C—
VRAM (memtest_vulkan, 4.5 min)no change—+28°C

TM1a is the system RAM: the SO-DIMMs or their regulator. It answers to memory traffic, not to computation, and it moves fast (30°C down two minutes after the load stops). DDR3 is meant to stay under 85°C. In a 90-second test it had reached 90.5.

Wasn't the SMC already doing this?

That was the first thing I asked myself once it was fixed. From what I measured, no. On its own, the SMC reads its probes, runs the fan on its own curve when nothing else does, and as a last resort shuts the machine down. On an Intel Mac running macOS, the fine-grained thermal management is done by the operating system, with per-model settings that tie the SMC's probes to CPU limits and the fan. On Linux, the applesmc driver only exposes the probes and the fan control: that layer doesn't exist.

The CPU's memory controller can throttle itself by temperature, but it needs a sensor on the module, and these SO-DIMMs don't have one. TM1a is a board thermistor that only the SMC can see. Under stress-ng, nothing slowed the RAM down before 90°C. I haven't been able to check whether macOS watches TM1a specifically on this model, but even if it does, you don't get that on Linux.

The fix: imac-fand

I wrote a small daemon, imac-fand, that every second reads the CPU temperature, the GPU temperature and every SMC probe. It puts each one on the curve for its kind (CPU, GPU, memory or board) and sets the fan from whichever asks for the most. When the RAM is in charge, the fan speeds up for it even with a cold CPU and GPU.

A fan at full speed isn't enough: a sustained memory load keeps climbing. So the daemon also caps the RAM's power through RAPL, Intel's power-limit interface, which on this Haswell has its own domain for memory. From 78°C it lowers the cap from 7 W towards 3 W (reached at 84°C), and it lifts it below 74°C. The CPU honours it by slowing the memory down, although it never goes below about 6 W whatever you ask for. Lowering the CPU frequency doesn't help: at 800 MHz the test still drew 7.8 W of RAM.

With the cap, the same test reaches 82°C at 90 seconds instead of 90.5. It's a safety net: in normal use it never kicks in. Showing a 5K desktop with full-screen video for several minutes, the RAM averaged 3.6 W and TM1a held steady around 70°C.

What heated it most: the screensaver

The surprise was Omarchy's screensaver. It's an animation in a full-screen terminal, and with Foot, which draws on the CPU, redrawing the 5K panel nonstop is almost as hard on the memory as stress-ng. With Alacritty, which draws on the GPU and its own memory, the RAM barely notices.

ScreensaverRAMTM1aFan
Foot (draws on the CPU)6.2 W58 → 77°C in 1 minfull speed
Alacritty (draws on the GPU)2.5 W58°C max≤ 1510 rpm
Idle, for reference2.3 W~55°Cfloor

With Foot, the RAM cap kicked in at 79°C and held it at 82.8°C after five minutes. With Alacritty nothing is needed: it's now the default terminal on this iMac, and the fan stays quiet. On an Intel iMac running Linux, use a terminal that draws on the GPU (Alacritty, Kitty or Ghostty rather than Foot): the 5K panel has so many pixels that drawing it on the CPU costs the RAM dearly.

Seeing it in the bar

All of this shows up in a widget for Omarchy's bar: fan rpm, CPU, GPU and memory temperature and usage, and disk. Whichever reading is driving the fan is highlighted, even with the panel closed. The panel shows the fan's range with the real rpm and the target, the mode (silent, normal or full) and a chart of the last two minutes.

Omarchy bar with the fan rpm and temperatures, and the panel open: the GPU at 56°C drives the fan at 1198 rpm, with a chart of CPU, GPU and TM1a over the last two minutes
The GPU is driving the fan (highlighted in the bar and in the panel). On the right of the bar, CPU and RAM watts from the power widget.

The RAM's watts come from another widget, omarchy-power-widget, which shows them on any machine whose RAPL has a memory domain. On my desktop PC, for instance, the RAM draws 1.5 W at idle.

Installing it

It's built for Omarchy on an iMac15,1, although the daemon should work on other Intel Macs with applesmc. The curves and limits are tuned for this model: check them before using it on another one.

omarchy plugin add https://github.com/marionuevo/omarchy-imac-stats.git --enable
omarchy bar put marionuevo.imac-stats --section left
sudo ~/.config/omarchy/plugins/marionuevo.imac-stats/daemon/install.sh

The daemon runs as a systemd service, separate from the bar: if the bar or the whole desktop dies, the fan keeps being regulated. When it stops, it hands the fan back to the SMC's automatic control and lifts the RAM cap.

Still unconfirmed: exactly where on the board TM1a sits (that needs the schematic) and whether macOS watches that probe. If you have an iMac from this era and try it, I'd like to hear how it goes.

omarchy-imac-stats GitHub · MIT