Hardware

Mac Studio Ticking or Clicking Under Load? A Blind Test You Can Run Yourself

1,838 words, 8 min

mac studio ticking gputick terminal

Tech news by email, once a week

Unsubscribe any time. Privacy policy

A short, dry tick from inside a Mac Studio, a fraction of a second after something heavy starts, is hard to explain to anyone who has not heard it. Apple’s own tests may pass, the sound may vanish when you take the Mac in, and “it comes and goes” is not a repair ticket.

This guide gives you a way to turn the guess into a measurement. A small program makes the tick happen on demand, a blind test shows which kind of load it follows, and a checklist, cheapest step first, separates a hardware fault from a software one. It was written around one Mac Studio (2026, Apple M5 Ultra, 96 GB, macOS 27.0.1) that started ticking on 17 November 2026, and it still has no known cause. This article does not claim one.

What the tick is, and what it is not

The sound in question is a short click or tick from inside the case, not from the speakers. It does not repeat at a fixed rate and it does not sound like fan noise. Before testing anything, rule out the sources that are easy to blame by mistake:

Advertisement
  • Speakers and monitor. Unplug both. If the tick continues, they are not the source.
  • USB and Thunderbolt devices. Unplug everything except keyboard and mouse. Spinning external drives and NAS boxes on the same desk are a classic false lead.
  • The power supply path. Plug the Mac straight into a wall socket, not into a strip or UPS.
  • The fans. A fan fault would normally follow fan speed, not the moment a load starts.

On that Mac, all of these were done: speakers unplugged, monitor unplugged, power straight into the wall. The tick stayed. No USB or audio errors, crash reports or overheating events showed up in the system log either.

What other owners report

Many of the Mac Studio noise threads we found are about a high-pitched whine, which is a different symptom. Clicks come up less often. The closest match we could read in full is a MacRumors thread from October 2026 about an M5 Max Mac Studio that clicked every 20 to 30 seconds regardless of load. The owner replaced the machine, and the replacement clicked too. The sound stopped when the Mac was plugged into a socket outside the office. The owner traced it to a solar power unit on the same house circuit, and a mains power conditioner fixed it while a cheap filtered adapter did not. It is one person’s account, but it shows why the second step in the checklist below is worth five minutes.

We did not find an Apple explanation, a repair notice or any source that ties this kind of tick to a specific component on Apple silicon. Anything below that sounds like a cause is a hypothesis, and we label it as one.

Make the tick happen on purpose: gputick

The first Mac Studio we tested ticked during heavy graphics work. Waiting for it to happen by chance makes any test unreliable, so gputick creates the load itself: a Metal compute job that either keeps the whole GPU busy for a short burst (large) or uses a tiny fraction of it (small), at a steady rhythm. It prints the clock time of each burst, so you can line the log up with a phone recording.

You need Apple’s command line tools. If swiftc is not found, install them with xcode-select --install. The full source is just below, in a box you can open and copy. Press Copy on the gputick.swift box, then run these two lines in Terminal to turn the clipboard into a file (the first one makes a working folder, which you can reuse for the second script):

mkdir -p ~/ticklab && cd ~/ticklab
pbpaste > gputick.swift
gputick.swiftSwift, 125 lines
Show the code
// gputick - a GPU burst load for finding out whether a Mac ticks when the GPU suddenly works.
// Needs nothing installed except Apple's command line tools: it runs in a fresh user account or a clean macOS install.
//
//   ./gputick                 large burst 0.4 s every 1.8 s, until Ctrl-C
//   ./gputick --small         small load, same timing (the control: it should stay silent on most Macs)
//   ./gputick --burst 0.05    50 ms bursts
//   ./gputick --period 3      one burst every 3 s
//   ./gputick --seconds 60    stop by itself
//   ./gputick --serve         wait for commands on standard input (used by ticklab.py)
//
// Each burst prints its clock time, so you can match it against a phone recording.
// Build: swiftc -O gputick.swift -o gputick

import Foundation
import Metal

var burst = 0.4, period = 1.8, seconds = 0.0, small = false, serve = false
var args = Array(CommandLine.arguments.dropFirst())
while !args.isEmpty {
    let a = args.removeFirst()
    switch a {
    case "--burst": burst = Double(args.removeFirst()) ?? burst
    case "--period": period = Double(args.removeFirst()) ?? period
    case "--seconds": seconds = Double(args.removeFirst()) ?? seconds
    case "--small": small = true
    case "--serve": serve = true
    default:
        print("unknown option \(a)"); exit(2)
    }
}

guard let dev = MTLCreateSystemDefaultDevice(), let queue = dev.makeCommandQueue() else {
    print("No Metal GPU available"); exit(1)
}

let src = """
#include <metal_stdlib>
using namespace metal;
kernel void spin(device float *out [[buffer(0)]], constant uint &iters [[buffer(1)]],
                 uint id [[thread_position_in_grid]]) {
    float a = float(id) * 1e-6f, b = 1.0001f, c = 0.9999f;
    for (uint i = 0; i < iters; i++) { a = fma(a, b, c); b = fma(b, c, a) * 0.5f; }
    out[id] = a + b;
}
"""
let lib = try! dev.makeLibrary(source: src, options: nil)
let pso = try! dev.makeComputePipelineState(function: lib.makeFunction(name: "spin")!)

// Large: the whole GPU busy. Small: a few threadgroups, a tiny fraction of it.
struct Load {
    let threads: Int
    var iters: UInt32
    let out: MTLBuffer
}
func makeLoad(threads: Int, iters: UInt32) -> Load {
    Load(threads: threads, iters: iters, out: dev.makeBuffer(length: threads * 4, options: .storageModePrivate)!)
}
let largeLoad = makeLoad(threads: 8 * 1024 * 1024, iters: 2048)
let smallLoad = makeLoad(threads: 4096, iters: 256)

func dispatch(_ load: Load) -> MTLCommandBuffer {
    var iters = load.iters
    let cb = queue.makeCommandBuffer()!
    let enc = cb.makeComputeCommandEncoder()!
    enc.setComputePipelineState(pso)
    enc.setBuffer(load.out, offset: 0, index: 0)
    enc.setBytes(&iters, length: 4, index: 1)
    let tg = min(pso.maxTotalThreadsPerThreadgroup, 256)
    enc.dispatchThreads(MTLSize(width: load.threads, height: 1, depth: 1),
                        threadsPerThreadgroup: MTLSize(width: tg, height: 1, depth: 1))
    enc.endEncoding()
    cb.commit()
    return cb
}

// Keep the GPU busy with this load for `length` seconds, at most two jobs in flight.
func runBurst(_ load: Load, _ length: Double, _ stopped: () -> Bool) {
    let start = Date()
    var last: MTLCommandBuffer? = nil
    while Date().timeIntervalSince(start) < length && !stopped() {
        if let l = last { l.waitUntilCompleted() }
        last = dispatch(load)
    }
    last?.waitUntilCompleted()
}

// Warm-up, so the first burst is not the shader compile.
_ = dispatch(largeLoad).waitUntilCompleted()
_ = dispatch(smallLoad).waitUntilCompleted()

if serve {
    // Lines in: "burst large 0.4", "burst small 0.05", "quit". Line out: "done" after each burst.
    print("READY"); fflush(stdout)
    while let line = readLine() {
        let p = line.split(separator: " ").map(String.init)
        if p.first == "quit" { break }
        guard p.count == 3, p[0] == "burst", let length = Double(p[2]) else { print("error"); fflush(stdout); continue }
        runBurst(p[1] == "small" ? smallLoad : largeLoad, length, { false })
        print("done"); fflush(stdout)
    }
    exit(0)
}

var stop = false
signal(SIGINT) { _ in stop = true }
signal(SIGTERM) { _ in stop = true }

let load = small ? smallLoad : largeLoad
let fmt = DateFormatter(); fmt.dateFormat = "HH:mm:ss.SSS"
print("gputick on \(dev.name): \(small ? "small" : "large") load, \(burst) s burst every \(period) s. Ctrl-C stops.")

let t0 = Date()
var n = 0
while !stop {
    let start = Date()
    n += 1
    print("\(fmt.string(from: start))  burst \(n)")
    fflush(stdout)
    runBurst(load, burst, { stop })
    if seconds > 0 && Date().timeIntervalSince(t0) >= seconds { break }
    let rest = period - Date().timeIntervalSince(start)
    if rest > 0 && !stop { Thread.sleep(forTimeInterval: rest) }
    if seconds > 0 && Date().timeIntervalSince(t0) >= seconds { break }
}
print("stopped after \(n) bursts")

Then build it and run it:

swiftc -O gputick.swift -o gputick
./gputick              # large bursts: 0.4 s every 1.8 s, until Ctrl-C
./gputick --small      # the control: same rhythm, tiny load
./gputick --burst 0.05 # 50 ms bursts
./gputick --period 3   # one burst every 3 s
./gputick --seconds 60 # stop by itself after a minute

Run it from a normal Terminal window. Inside a sandbox or virtual machine Metal is hidden and the program prints “No Metal GPU available”.

Terminal window showing gputick running large 0.4 second GPU bursts with a timestamp for each burst
gputick with the default large load: one burst every 1.8 seconds, each with its clock time.
Terminal window showing gputick --small running the same rhythm with a tiny load
The same rhythm with --small. This is the control: if the tick follows this too, the cause is probably not the size of the GPU load.

On the Mac Studio we tested, activity readings put the large bursts at 69 to 98 percent GPU use and the small load at about zero. The pair is the point of the tool: same timing, very different power draw.

The blind test: which load does the tick follow?

Listening while you start the load yourself is easy to fool. You hear what you expect. The second program, ticklab.py, removes that. It runs eleven short segments in random order: silence, large and small GPU bursts, an all-core CPU burst, a single-core wake and an SSD write. The screen only says “Listening”, so you do not know what is running. You press Space each time you hear a tick, and the report afterwards names the segments.

How the result is worked out:

  • A press counts as a reaction to a load when it lands between 0.1 and 0.9 seconds after the burst starts.
  • The silence segments give the chance level: how often you press when nothing is running.
  • The main comparison pools all large GPU bursts against all small ones and applies a one-sided Fisher exact test. A p-value under 0.01 means the ticks follow the size of the GPU load, not the act of running a test.

ticklab.py has to sit in the same folder as the built gputick. Press Copy on the box below, then in the same Terminal window:

pbpaste > ticklab.py
ticklab.pyPython, 829 lines
Show the code
#!/usr/bin/env python3
"""
ticklab - a blind test for a Mac that ticks. You press Space each time you hear a tick; ticklab works out
which kind of load the ticks follow.

    swiftc -O gputick.swift -o gputick        # once; needs Apple's command line tools (xcode-select --install)
    python3 ticklab.py                        # blind run, about 4 minutes
    python3 ticklab.py --quick                # about half of that
    python3 ticklab.py --open                 # not blind: names each segment first, fixed order
    python3 ticklab.py --list                 # list the segments and how long they take
    python3 ticklab.py --report LOG.jsonl     # work out the report again from a saved log
    python3 ticklab.py --selftest             # check the maths, no hardware

Blind run (the default): the segments run in a random order and the screen only says "Listening", so you
cannot know whether a large GPU load, a small one, a CPU load or silence is running. The report names them
afterwards. Press SPACE the instant you hear a tick. u = undo last press, s = skip segment, q = quit and write
the report. Keep your hands off the keyboard otherwise, and put the phone down next to the case if you want a
recording as well.

Output goes to ./ticklab-logs/: ticklab-<time>.jsonl (raw timeline) and ticklab-<time>.md (the report).

The screen is kept still while a segment runs (it only changes when you press a key), so the program's own
drawing does not add ticks.

How a result is worked out:
  - A press counts as a reaction to a timed event when it lands 0.10-0.90 s after the event starts.
  - The silence segments give the chance level: how often you press with nothing running.
  - The main question is large GPU loads against small GPU loads, pooled over their segments, with a
    one-sided Fisher exact test (are ticks heard more often after large loads than after small ones?).
    A small p (under 0.01) means the ticks follow the size of the GPU load, not the mere act of
    working or the timing of the test.
"""
import argparse
import datetime
import json
import math
import os
import platform
import random
import re
import select
import shutil
import signal
import statistics
import subprocess
import sys
import tempfile
import textwrap
import threading
import time

HERE = os.path.dirname(os.path.abspath(__file__))
OUT_ROOT = os.path.join(os.getcwd(), "ticklab-logs")
GPUTICK = os.path.join(HERE, "gputick")
GPUTICK_SRC = os.path.join(HERE, "gputick.swift")

REACT_MIN = 0.10      # a press earlier than this after an event is not a reaction to it
REACT_MAX = 0.90      # a press later than this is not a reaction to it
DEBOUNCE = 0.12       # ignore key auto-repeat faster than this
COUNTDOWN = 2
P_LIMIT = 0.01        # the Fisher p-value below which the ticks are said to follow the GPU load size
BLIND_BLURB = ("Press SPACE the instant you hear a tick. Nothing on this screen says what is running: it may be "
               "a load, or silence.")

ESC = "\x1b"


# --------------------------------------------------------------------------- logging

class Log:
    def __init__(self, path):
        self.path = path
        self.records = []
        self.lock = threading.Lock()
        self.fh = open(path, "w", buffering=1) if path else None

    def add(self, kind, **kw):
        rec = {"t": kw.pop("t", None) or time.time(), "kind": kind}
        rec.update(kw)
        with self.lock:
            self.records.append(rec)
            if self.fh:
                self.fh.write(json.dumps(rec) + "\n")
        return rec

    def close(self):
        if self.fh:
            self.fh.close()


# --------------------------------------------------------------------------- terminal UI

class UI:
    ROW_COUNT = 17

    def __init__(self):
        self.lock = threading.Lock()
        self.fd = sys.stdin.fileno()
        self.old = None
        self.count = 0
        self.last = "-"
        self.blind = False

    def start(self):
        if sys.stdin.isatty():
            self.old = __import__("termios").tcgetattr(self.fd)
            __import__("tty").setcbreak(self.fd)
        sys.stdout.write(ESC + "[?25l")
        sys.stdout.flush()

    def stop(self):
        sys.stdout.write(ESC + "[?25h" + ESC + "[0m\n")
        sys.stdout.flush()
        if self.old is not None:
            termios = __import__("termios")
            termios.tcsetattr(self.fd, termios.TCSADRAIN, self.old)

    def draw(self, status, title, blurb, bottom, idx, total):
        if self.blind:
            status = "LISTENING" if status == "RUNNING" else "NEXT SEGMENT"
            title, blurb = "Listening", BLIND_BLURB
        lines = [
            "TICKLAB   %s        SPACE = tick   u = undo   s = skip   q = quit"
            % datetime.datetime.now().strftime("%H:%M"),
            "",
            "%s   (segment %d of %d)" % (status, idx, total),
            "",
            title,
            "",
        ]
        lines += textwrap.wrap(blurb, 76)
        lines += ["", "Press SPACE the instant you hear a tick.", ""]
        with self.lock:
            out = [ESC + "[2J" + ESC + "[H"]
            for i, ln in enumerate(lines, 1):
                out.append(ESC + "[%d;1H%s" % (i, ln))
            out.append(ESC + "[%d;1H%s" % (14, bottom))
            out.append(self._count_text())
            sys.stdout.write("".join(out))
            sys.stdout.flush()

    def _count_text(self):
        return ESC + "[%d;1H" % self.ROW_COUNT + ESC + "[2K" + "ticks pressed: %d      last: %s" % (self.count, self.last)

    def bottom(self, text):
        with self.lock:
            sys.stdout.write(ESC + "[14;1H" + ESC + "[2K" + text)
            sys.stdout.flush()

    def pressed(self, n, stamp):
        with self.lock:
            self.count = n
            self.last = stamp
            sys.stdout.write(self._count_text())
            sys.stdout.flush()

    def message(self, text):
        with self.lock:
            sys.stdout.write(ESC + "[19;1H" + ESC + "[2K" + text)
            sys.stdout.flush()


# --------------------------------------------------------------------------- run context

class Ctx:
    def __init__(self, log, ui, quick):
        self.log = log
        self.ui = ui
        self.quick = quick
        self.phase = "start"
        self.skip = False
        self.quit = False
        self.stop_input = False
        self.presses = 0

    def wait(self, seconds):
        """Sleep, but wake early on skip/quit. Returns False if interrupted."""
        end = time.monotonic() + seconds
        while time.monotonic() < end:
            if self.skip or self.quit:
                return False
            time.sleep(min(0.05, max(0.0, end - time.monotonic())))
        return not (self.skip or self.quit)

    def pulse(self, label, t0, t1):
        self.log.add("pulse", t=t0, t_end=t1, phase=self.phase, label=label)


def input_loop(ctx):
    fd = sys.stdin.fileno()
    last_press = 0.0
    while not ctx.stop_input:
        try:
            r, _, _ = select.select([fd], [], [], 0.05)
        except (OSError, ValueError):
            return
        if not r:
            continue
        try:
            data = os.read(fd, 64)
        except OSError:
            return
        t = time.time()
        if not data:
            return
        for ch in data.decode("utf-8", "ignore"):
            if ch == " ":
                if t - last_press < DEBOUNCE:
                    continue
                last_press = t
                ctx.presses += 1
                ctx.log.add("press", t=t, phase=ctx.phase)
                ctx.ui.pressed(ctx.presses, datetime.datetime.fromtimestamp(t).strftime("%H:%M:%S.%f")[:-3])
            elif ch in "uU":
                if ctx.presses > 0:
                    ctx.presses -= 1
                    ctx.log.add("undo", t=t, phase=ctx.phase)
                    ctx.ui.pressed(ctx.presses, "undone")
            elif ch in "sS":
                ctx.skip = True
            elif ch in "qQ":
                ctx.quit = True


# --------------------------------------------------------------------------- activities

def run(cmd, timeout=20):
    try:
        return subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
    except Exception as e:  # noqa
        return subprocess.CompletedProcess(cmd, 1, "", str(e))


def cpu_burst(workers, dur):
    t0 = time.time()
    procs = [subprocess.Popen(["yes"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) for _ in range(workers)]
    time.sleep(dur)
    for p in procs:
        p.kill()
    for p in procs:
        p.wait()
    return t0, time.time()


def pulses(ctx, ph, label, fn):
    """Run fn() n times. Start offset and spacing are jittered so the rhythm cannot be anticipated."""
    n = ph["n"]
    if not ctx.wait(random.uniform(0.3, 1.5)):
        return
    for i in range(n):
        if ctx.skip or ctx.quit:
            return
        spacing = ph["spacing"] * random.uniform(0.8, 1.2)
        t_loop = time.monotonic()
        t0, t1 = fn()
        ctx.pulse(label, t0, t1)
        if not ctx.wait(max(0.0, spacing - (time.monotonic() - t_loop))):
            return


def ph_idle(ctx, ph):
    ctx.wait(ph["dur"])


def ph_cpu_burst(ctx, ph):
    workers = os.cpu_count() or 8
    pulses(ctx, ph, "all-core CPU burst 0.4 s", lambda: cpu_burst(workers, 0.4))


def ph_cpu_single(ctx, ph):
    pulses(ctx, ph, "single-core CPU wake 0.05 s", lambda: cpu_burst(1, 0.05))


class GpuHelper:
    """One gputick process in --serve mode for the whole run (starting it compiles a shader, which takes a second)."""

    def __init__(self):
        self.p = None
        self.err = None

    def start(self):
        if not os.path.exists(GPUTICK):
            if not os.path.exists(GPUTICK_SRC) or not shutil.which("swiftc"):
                self.err = ("gputick is not built: run  swiftc -O gputick.swift -o gputick  next to ticklab.py "
                            "(needs xcode-select --install)")
                return
            print("  building gputick ...")
            b = run(["swiftc", "-O", GPUTICK_SRC, "-o", GPUTICK], timeout=240)
            if b.returncode != 0 or not os.path.exists(GPUTICK):
                self.err = "gputick would not build"
                return
        self.p = subprocess.Popen([GPUTICK, "--serve"], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                                  stderr=subprocess.DEVNULL, text=True, bufsize=1)
        r, _, _ = select.select([self.p.stdout], [], [], 30)
        if not r or self.p.stdout.readline().strip() != "READY":
            self.err = "gputick did not start (No Metal GPU? Inside a sandbox or a virtual machine, Metal is hidden)"
            self.close()

    def pulse(self, kind, dur):
        t0 = time.time()
        self.p.stdin.write("burst %s %s\n" % (kind, dur))
        self.p.stdin.flush()
        if self.p.stdout.readline().strip() != "done":
            raise RuntimeError("gputick stopped")
        return t0, time.time()

    def close(self):
        if self.p is None:
            return
        try:
            self.p.stdin.write("quit\n")
            self.p.stdin.flush()
        except Exception:  # noqa
            pass
        self.p.kill()
        self.p = None


GPU = GpuHelper()


def make_gpu_phase(kind, dur, label):
    def fn(ctx, ph):
        if GPU.p is None:
            return GPU.err or "gputick not started"
        try:
            pulses(ctx, ph, label, lambda: GPU.pulse(kind, dur))
        except (RuntimeError, OSError, ValueError) as e:
            return str(e)
    return fn


def ph_disk(ctx, ph):
    d = tempfile.mkdtemp(prefix="ticklab-")
    size_mb = ph["mb"]
    chunk = bytes(1024 * 1024)

    def one():
        t0 = time.time()
        with open(os.path.join(d, "blob"), "wb") as f:
            for _ in range(size_mb):
                f.write(chunk)
            f.flush()
            os.fsync(f.fileno())
        t1 = time.time()
        os.remove(os.path.join(d, "blob"))
        return t0, t1

    try:
        pulses(ctx, ph, "SSD write %d MB + fsync" % size_mb, one)
    finally:
        shutil.rmtree(d, ignore_errors=True)


def build_phases(quick):
    k = 0.5 if quick else 1.0

    def cnt(x):
        return max(4, int(round(x * k)))

    # group "large" and "small" are the GPU segments the Fisher test compares; each size has the same events in total.
    return [
        dict(key="idle", title="Silence (baseline)", kind="continuous", dur=int(20 * k), fn=ph_idle,
             blurb="Nothing runs. This sets how often you press on your own."),
        dict(key="gpu_large", title="Large GPU burst", kind="pulses", n=cnt(8), spacing=1.8, group="large",
             fn=make_gpu_phase("large", 0.4, "large GPU burst 0.4 s"),
             blurb="The whole GPU is busy for 0.4 s, about once every 1.8 s. Nothing is drawn on screen."),
        dict(key="gpu_small", title="Small GPU burst", kind="pulses", n=cnt(8), spacing=1.8, group="small",
             fn=make_gpu_phase("small", 0.4, "small GPU burst 0.4 s"),
             blurb="A tiny fraction of the GPU is busy for 0.4 s, about once every 1.8 s."),
        dict(key="gpu_large_short", title="Large GPU burst, very short", kind="pulses", n=cnt(10), spacing=1.6, group="large",
             fn=make_gpu_phase("large", 0.05, "large GPU burst 0.05 s"),
             blurb="The whole GPU is busy for only 0.05 s, about once every 1.6 s."),
        dict(key="gpu_small_short", title="Small GPU burst, very short", kind="pulses", n=cnt(10), spacing=1.6, group="small",
             fn=make_gpu_phase("small", 0.05, "small GPU burst 0.05 s"),
             blurb="A tiny fraction of the GPU is busy for only 0.05 s, about once every 1.6 s."),
        dict(key="cpu_burst", title="CPU burst, all cores", kind="pulses", n=cnt(8), spacing=1.8, fn=ph_cpu_burst,
             blurb="Every core is loaded for 0.4 s, about once every 1.8 s. Nothing visible happens on screen."),
        dict(key="cpu_single", title="CPU wake, one core", kind="pulses", n=cnt(10), spacing=1.6, fn=ph_cpu_single,
             blurb="One core wakes for 0.05 s, about once every 1.6 s. A short, sharp load change."),
        dict(key="gpu_large2", title="Large GPU burst, repeat", kind="pulses", n=cnt(8), spacing=1.8, group="large",
             fn=make_gpu_phase("large", 0.4, "large GPU burst 0.4 s (repeat)"),
             blurb="The first large GPU test again, to see whether the result repeats."),
        dict(key="gpu_small2", title="Small GPU burst, repeat", kind="pulses", n=cnt(8), spacing=1.8, group="small",
             fn=make_gpu_phase("small", 0.4, "small GPU burst 0.4 s (repeat)"),
             blurb="The first small GPU test again, to see whether the result repeats."),
        dict(key="disk_write", title="SSD write burst", kind="pulses", n=cnt(4), spacing=3.5, mb=512 if not quick else 256,
             fn=ph_disk, blurb="A large file is written to the SSD and flushed, about once every 3.5 s, then deleted."),
        dict(key="idle_end", title="Silence again (baseline 2)", kind="continuous", dur=int(20 * k), fn=ph_idle,
             blurb="Nothing runs. Compared with the first silence to see whether things drifted."),
    ]


def order_phases(phases, blind, rng):
    """Blind: shuffle the segments. Open: keep the written order."""
    out = list(phases)
    if blind:
        rng.shuffle(out)
    return out


def estimate_seconds(phases, countdown):
    total = 0.0
    for p in phases:
        total += (p["dur"] if p["kind"] == "continuous" else 1.0 + p["n"] * p["spacing"]) + countdown + 1.0
    return total


def fmt_minutes(s):
    return "%d min %02d s" % (s // 60, round(s % 60))


# --------------------------------------------------------------------------- analysis

def fisher_greater(a, n1, b, n2):
    """One-sided Fisher exact test: probability of at least `a` hits in n1 events, given `a + b` hits in n1 + n2 events
    and no difference between the two groups. Pure standard library."""
    hits, total = a + b, n1 + n2
    if n1 == 0 or n2 == 0 or total == 0:
        return None
    denom = math.comb(total, hits)
    return sum(math.comb(n1, i) * math.comb(n2, hits - i) for i in range(a, min(n1, hits) + 1)) / denom


def analyse(records):
    presses = []
    pph = []
    for r in records:
        if r["kind"] == "press":
            presses.append(r["t"])
            pph.append(r.get("phase", ""))
        elif r["kind"] == "undo" and presses:
            presses.pop()
            pph.pop()

    phases = []
    by_key = {}
    for r in records:
        if r["kind"] == "phase_start":
            d = dict(key=r["key"], title=r["title"], pkind=r["pkind"], group=r.get("group"), t0=r["t"], t1=None, skipped=None)
            phases.append(d)
            by_key[r["key"]] = d
        elif r["kind"] == "phase_end" and r["key"] in by_key:
            by_key[r["key"]]["t1"] = r["t"]
        elif r["kind"] == "phase_skipped" and r["key"] in by_key:
            by_key[r["key"]]["skipped"] = r["reason"]
            by_key[r["key"]]["t1"] = r["t"]

    # chance level from the silence segments
    idle_s = 0.0
    idle_n = 0
    for d in phases:
        if d["key"].startswith("idle") and d["t1"] and not d["skipped"]:
            a, b = d["t0"], d["t1"]
            idle_s += max(0.0, b - a)
            idle_n += sum(1 for p in presses if a + 0.3 <= p <= b + 0.3)
    base_rate = (idle_n / idle_s) if idle_s > 0 else 0.0

    out = dict(baseline=dict(seconds=idle_s, presses=idle_n, per_min=base_rate * 60), phases=[], total_presses=len(presses))
    used = set()
    groups = {"large": [0, 0], "small": [0, 0]}      # events, heard
    for d in phases:
        res = dict(key=d["key"], title=d["title"], kind=d["pkind"], skipped=d["skipped"])
        if d["skipped"] or not d["t1"]:
            res.update(verdict="skipped" if d["skipped"] else "not finished")
            out["phases"].append(res)
            continue
        if d["pkind"] == "pulses":
            ps = sorted((r for r in records if r["kind"] == "pulse" and r["phase"] == d["key"]), key=lambda r: r["t"])
            matched = 0
            lat = []
            avg_len = 0.0
            for pu in ps:
                lo, hi = pu["t"] + REACT_MIN, pu["t_end"] + REACT_MAX
                avg_len += pu["t_end"] - pu["t"]
                for i, p in enumerate(presses):
                    if i in used:
                        continue
                    if lo <= p <= hi:
                        used.add(i)
                        matched += 1
                        lat.append((p - pu["t"]) * 1000)
                        break
            n = len(ps)
            avg_len = avg_len / n if n else 0.0
            window = (REACT_MAX - REACT_MIN) + avg_len
            chance = n * window * base_rate if idle_s > 0 else None
            hit = matched / n if n else 0.0
            if n == 0:
                verdict = "no events"
            elif matched >= 3 and hit >= 0.5 and matched > 2 * (chance or 0.0) + 1:
                verdict = "ticks follow this activity"
            elif hit <= 0.2:
                verdict = "no link seen"
            else:
                verdict = "unclear"
            if d.get("group") in groups:
                groups[d["group"]][0] += n
                groups[d["group"]][1] += matched
            res.update(events=n, matched=matched, hit_pct=round(hit * 100), median_ms=round(statistics.median(lat)) if lat else None,
                       chance=None if chance is None else round(chance, 1), verdict=verdict)
        else:
            a, b = d["t0"], d["t1"]
            secs = max(0.001, b - a)
            c = sum(1 for p in presses if a + 0.3 <= p <= b + 0.3)
            rate = c / secs * 60
            verdict = "baseline" if d["key"].startswith("idle") else "ticks while this runs" if c >= 3 else "no ticks"
            res.update(seconds=round(secs), presses=c, per_min=round(rate, 1), verdict=verdict)
        out["phases"].append(res)

    (ln, lh), (sn, sh) = groups["large"], groups["small"]
    p = fisher_greater(lh, ln, sh, sn) if ln and sn else None
    out["gpu"] = dict(large_events=ln, large_heard=lh, small_events=sn, small_heard=sh, p=p)
    if p is None:
        out["gpu"]["verdict"] = "not tested: the run had no large and small GPU segments"
    elif p < P_LIMIT and lh > 0:
        out["gpu"]["verdict"] = "ticks follow large GPU loads (p below %s)" % P_LIMIT
    elif lh + sh == 0:
        out["gpu"]["verdict"] = "no ticks heard after any GPU load"
    else:
        out["gpu"]["verdict"] = "no clear difference between large and small GPU loads"

    # presses that belong to no event and fall outside the silence segments
    bg = [r for r in records if r["kind"] == "bg"]
    strays = []
    for i, p_ in enumerate(presses):
        if i in used:
            continue
        near = min(bg, key=lambda r: abs(r["t"] - p_), default=None)
        busy = ""
        if near is not None and abs(near["t"] - p_) <= 6:
            busy = ", ".join("%s %d%%" % (n, c) for n, c in near["top"]) or "nothing above 8% CPU"
        strays.append(dict(t=p_, phase=pph[i], busy=busy))
    out["strays"] = strays
    return out


def bg_sampler(log, stop):
    """Every 5 s, note which other processes use noticeable CPU (to explain stray ticks)."""
    me = os.getpid()
    while not stop.is_set():
        rows = []
        for ln in run(["ps", "-Ao", "pcpu=,pid=,ppid=,comm="], timeout=10).stdout.splitlines():
            parts = ln.split(None, 3)
            if len(parts) < 4:
                continue
            try:
                c, pid, ppid = float(parts[0]), int(parts[1]), int(parts[2])
            except ValueError:
                continue
            if pid == me or ppid == me or c < 8.0:
                continue
            rows.append((c, os.path.basename(parts[3].strip())))
        rows.sort(reverse=True)
        log.add("bg", top=[[n, round(c)] for c, n in rows[:3]])
        stop.wait(5)


def machine_info():
    def sh(cmd):
        return run(cmd, timeout=10).stdout.strip()

    return {
        "date": datetime.datetime.now().strftime("%d %b %Y, %H:%M"),
        "macOS": sh(["sw_vers", "-productVersion"]) or platform.mac_ver()[0],
        "model": sh(["sysctl", "-n", "hw.model"]),
        "chip": sh(["sysctl", "-n", "machdep.cpu.brand_string"]),
        "cores": os.cpu_count(),
        "uptime": (re.search(r"up (.*?),\s+\d+ user", sh(["uptime"])) or [None, "unknown"])[1],
    }


def render_report(info, result, out_name):
    L = []
    L.append("# Tick log")
    L.append("")
    L.append("Recorded %s. %s, macOS %s, %s, %s cores. Uptime: %s."
             % (info["date"], info["model"], info["macOS"], info["chip"], info["cores"], info["uptime"]))
    L.append("")
    if info.get("mode"):
        L.append("Mode: %s." % info["mode"])
        L.append("")
    if result["phases"]:
        L.append("Run order: %s." % ", ".join(p["title"] for p in result["phases"]))
        L.append("")
    L.append("Method: each activity ran on a timer while the listener pressed Space at each audible tick. A press counts "
             "as matched to a timed event when it lands %.2f-%.2f s after the event starts (reaction time)." % (REACT_MIN, REACT_MAX))
    L.append("")
    b = result["baseline"]
    if b["seconds"] > 0:
        L.append("Baseline (silence): %d presses in %d s = %.1f per minute." % (b["presses"], round(b["seconds"]), b["per_min"]))
    else:
        L.append("Baseline (silence): not measured, this run had no silence segment, so no chance level is given.")
    L.append("")
    g = result["gpu"]
    L.append("## Large against small GPU loads")
    L.append("")
    L.append("| Load | Events | Heard |")
    L.append("| --- | --- | --- |")
    L.append("| Large GPU | %d | %d |" % (g["large_events"], g["large_heard"]))
    L.append("| Small GPU | %d | %d |" % (g["small_events"], g["small_heard"]))
    L.append("")
    if g["p"] is not None:
        L.append("One-sided Fisher exact test, large against small: p = %s. Result: %s." % (
            ("%.2g" % g["p"]), g["verdict"]))
    else:
        L.append("Result: %s." % g["verdict"])
    L.append("")
    L.append("## Timed events (single loads)")
    L.append("")
    L.append("| Activity | Events | Heard (matched) | Hit rate | Median delay from event start | Expected by chance | Result |")
    L.append("| --- | --- | --- | --- | --- | --- | --- |")
    for p in result["phases"]:
        if p["kind"] != "pulses":
            continue
        if p.get("skipped") or "events" not in p:
            L.append("| %s | | | | | | %s |" % (p["title"], p["verdict"] + (": " + p["skipped"] if p.get("skipped") else "")))
        else:
            L.append("| %s | %d | %d | %d%% | %s | %s | %s |" % (
                p["title"], p["events"], p["matched"], p["hit_pct"],
                ("%d ms" % p["median_ms"]) if p["median_ms"] is not None else "-",
                "n/a" if p["chance"] is None else p["chance"], p["verdict"]))
    L.append("")
    L.append("## Silence")
    L.append("")
    L.append("| Segment | Seconds | Presses | Per minute |")
    L.append("| --- | --- | --- | --- |")
    for p in result["phases"]:
        if p["kind"] != "continuous":
            continue
        if p.get("skipped") or "seconds" not in p:
            L.append("| %s | | | %s |" % (p["title"], p["verdict"] + (": " + p["skipped"] if p.get("skipped") else "")))
        else:
            L.append("| %s | %d | %d | %s |" % (p["title"], p["seconds"], p["presses"], p["per_min"]))
    L.append("")
    if result.get("strays"):
        L.append("## Presses that match no timed event")
        L.append("")
        L.append("Ticks heard outside the timed events, with the busiest other processes in the 6 s around each "
                 "(ps CPU averages, approximate).")
        L.append("")
        L.append("| Time | During | Busiest other processes |")
        L.append("| --- | --- | --- |")
        for s in result["strays"]:
            L.append("| %s | %s | %s |" % (datetime.datetime.fromtimestamp(s["t"]).strftime("%H:%M:%S"), s["phase"],
                                          s["busy"] or "not sampled"))
        L.append("")
    L.append("Total presses: %d. Raw timeline (every event and press with millisecond times): `%s`." % (result["total_presses"], out_name))
    return "\n".join(L) + "\n"


# --------------------------------------------------------------------------- main

def selftest():
    random.seed(3)
    # Fisher: known values. 5 of 5 against 0 of 5 -> 1/252; equal groups -> 1.0; 3/10 vs 1/10 -> 0.3
    assert abs(fisher_greater(5, 5, 0, 5) - 1 / 252) < 1e-12
    assert abs(fisher_greater(0, 5, 0, 5) - 1.0) < 1e-12
    assert fisher_greater(1, 0, 0, 5) is None
    assert 0.0 < fisher_greater(9, 26, 1, 26) < 0.01
    assert fisher_greater(2, 26, 2, 26) > 0.4

    t = 1_000_000.0
    rec = []

    def ps(key, title, kind, group=None):
        rec.append(dict(t=t, kind="phase_start", key=key, title=title, pkind=kind, group=group))

    def pe(key):
        rec.append(dict(t=t, kind="phase_end", key=key))

    ps("idle", "Silence", "continuous"); t += 30; pe("idle")
    for key, group, hear in (("gpu_large", "large", lambda i: i % 3 != 0), ("gpu_small", "small", lambda i: False)):
        ps(key, key, "pulses", group)
        for i in range(10):
            t += 2
            rec.append(dict(t=t, kind="pulse", t_end=t + 0.4, phase=key, label="x"))
            if hear(i):
                rec.append(dict(t=t + 0.3 + random.random() * 0.2, kind="press", phase=key))
        t += 2; pe(key)
    ps("idle_end", "Silence again", "continuous"); t += 20; pe("idle_end")
    res = analyse(rec)
    by = {p["key"]: p for p in res["phases"]}
    assert by["gpu_large"]["matched"] == 6 and by["gpu_large"]["verdict"] == "ticks follow this activity", by["gpu_large"]
    assert by["gpu_small"]["matched"] == 0 and by["gpu_small"]["verdict"] == "no link seen", by["gpu_small"]
    g = res["gpu"]
    assert (g["large_events"], g["large_heard"], g["small_events"], g["small_heard"]) == (10, 6, 10, 0), g
    assert g["p"] < 0.01 and g["verdict"].startswith("ticks follow large GPU loads"), g
    info = dict(date="selftest", model="Mac", macOS="0", chip="chip", cores=30, uptime="up")
    print(render_report(info, res, "selftest.jsonl"))
    # no silence segment: no chance level
    res2 = analyse([r for r in rec if r.get("key") not in ("idle", "idle_end")])
    assert res2["baseline"]["seconds"] == 0 and all(p.get("chance") is None for p in res2["phases"] if p["kind"] == "pulses"), res2
    assert "not measured" in render_report(info, res2, "x.jsonl")
    # quiet machine: nothing heard anywhere
    quiet = [r for r in rec if r["kind"] != "press"]
    assert analyse(quiet)["gpu"]["verdict"] == "no ticks heard after any GPU load"
    # blind order: seeded, complete, open order untouched
    allp = build_phases(False)
    a = [p["key"] for p in order_phases(allp, True, random.Random(7))]
    b = [p["key"] for p in order_phases(allp, True, random.Random(7))]
    assert a == b and sorted(a) == sorted(p["key"] for p in allp), a
    assert [p["key"] for p in order_phases(allp, False, random.Random(7))] == [p["key"] for p in allp]
    assert len({tuple(p["key"] for p in order_phases(allp, True, random.Random(i))) for i in range(20)}) > 10
    # large and small have the same number of events
    for quick in (False, True):
        ph = build_phases(quick)
        assert sum(p["n"] for p in ph if p.get("group") == "large") == sum(p["n"] for p in ph if p.get("group") == "small")
    print("selftest ok")


def main():
    ap = argparse.ArgumentParser(description="Blind test: which load does the tick follow?")
    ap.add_argument("--quick", action="store_true")
    ap.add_argument("--list", action="store_true")
    ap.add_argument("--only", default="", help="comma-separated segment names (see --list)")
    ap.add_argument("--selftest", action="store_true")
    ap.add_argument("--report", metavar="LOG.jsonl", help="write the report again from a saved log and exit")
    ap.add_argument("--open", action="store_true", help="not blind: name each segment first, run them in the written order")
    ap.add_argument("--seed", type=int, default=None, help="seed for the blind order (default: random, logged)")
    ap.add_argument("--countdown", type=int, default=COUNTDOWN, help="seconds of announcement before each segment")
    args = ap.parse_args()

    if args.selftest:
        return selftest()
    if args.report:
        with open(args.report) as f:
            records = [json.loads(ln) for ln in f if ln.strip()]
        meta = next((r for r in records if r["kind"] == "meta"), {})
        info = dict(date="?", model="?", macOS="?", chip="?", cores="?", uptime="?")
        info.update({k: v for k, v in meta.items() if k in info or k == "mode"})
        print(render_report(info, analyse(records), os.path.basename(args.report)))
        return
    phases = build_phases(args.quick)
    if args.list:
        for p in phases:
            secs = p["dur"] if p["kind"] == "continuous" else 1.0 + p["n"] * p["spacing"]
            print("%-16s %3d s  %s" % (p["key"], secs, p["title"]))
        print("\nabout %s in all" % fmt_minutes(estimate_seconds(phases, COUNTDOWN)))
        return
    blind = not args.open
    if args.only:
        want = [w.strip() for w in args.only.split(",")]
        phases = [p for p in phases if p["key"] in want]
    if not phases:
        sys.exit("no segments selected")
    if not sys.stdin.isatty():
        sys.exit("ticklab needs a terminal to read key presses")

    os.makedirs(OUT_ROOT, exist_ok=True)
    stamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
    jsonl = os.path.join(OUT_ROOT, "ticklab-%s.jsonl" % stamp)
    md = os.path.join(OUT_ROOT, "ticklab-%s.md" % stamp)
    log = Log(jsonl)
    ui = UI()
    ui.blind = blind
    ctx = Ctx(log, ui, args.quick)

    seed = args.seed if args.seed is not None else random.SystemRandom().randrange(1, 10 ** 6)
    phases = order_phases(phases, blind, random.Random(seed))
    mode = ("blind, segments shuffled (seed %d), names hidden from the listener" % seed) if blind else "open, fixed order, names shown"
    info = machine_info()
    info["mode"] = mode
    info["order"] = [p["key"] for p in phases]
    log.add("meta", **info)

    if any(p["key"].startswith("gpu") for p in phases):
        print("Starting the GPU load ...")
        GPU.start()
        if GPU.err:
            print("  %s: the GPU segments will be skipped" % GPU.err)
    print("%s, %d segments, about %s. Starting." % ("Blind run" if blind else "Open run", len(phases),
                                                    fmt_minutes(estimate_seconds(phases, args.countdown))))
    time.sleep(1)

    signal.signal(signal.SIGTERM, lambda *_: setattr(ctx, "quit", True))
    bg_stop = threading.Event()
    threading.Thread(target=bg_sampler, args=(log, bg_stop), daemon=True).start()
    ui.start()
    th = threading.Thread(target=input_loop, args=(ctx,), daemon=True)
    th.start()
    try:
        total = len(phases)
        for idx, ph in enumerate(phases, 1):
            if ctx.quit:
                break
            ctx.skip = False
            ctx.phase = "gap"
            ui.draw("NEXT", ph["title"], ph["blurb"], "", idx, total)
            for s in range(args.countdown, 0, -1):
                ui.bottom("Starting in %d s" % s)
                if not ctx.wait(1.0):
                    break
            if ctx.quit:
                break
            ctx.skip = False
            ui.draw("RUNNING", ph["title"], ph["blurb"], "Running. This screen stays still on purpose.", idx, total)
            ctx.phase = ph["key"]
            log.add("phase_start", key=ph["key"], title=ph["title"], pkind=ph["kind"], group=ph.get("group"))
            reason = ph["fn"](ctx, ph)
            ctx.phase = "gap"
            if reason:
                log.add("phase_skipped", key=ph["key"], reason=reason)
                ui.message("Skipped: %s" % ("a segment could not run" if blind else reason))
                time.sleep(1)
            else:
                log.add("phase_end", key=ph["key"])
    finally:
        GPU.close()
        ctx.stop_input = True
        bg_stop.set()
        th.join(timeout=1)
        ui.stop()
        # close any segment left open (quit mid-segment)
        open_keys = {r["key"] for r in log.records if r["kind"] == "phase_start"} - \
            {r["key"] for r in log.records if r["kind"] in ("phase_end", "phase_skipped")}
        for k in open_keys:
            log.add("phase_end", key=k)
        log.close()

    result = analyse(log.records)
    with open(md, "w") as f:
        f.write(render_report(info, result, os.path.basename(jsonl)))
    print("Report: %s" % os.path.relpath(md))
    print(result["gpu"]["verdict"])


if __name__ == "__main__":
    main()

The whole run takes about 3 minutes 36 seconds, and --quick halves that:

python3 ticklab.py --list    # the segments and how long they take
python3 ticklab.py           # the blind run
Terminal window showing the ticklab --list output with eleven segments and a total of about 3 minutes 36 seconds
ticklab.py --list: the eleven segments and the time each takes.
Terminal window showing the ticklab blind screen that only says Listening
The blind screen. It says nothing about what is running.

Keep your hands off the keyboard except for Space (u undoes a press, s skips a segment, q stops and writes the report). Put a phone next to the case and record the session as well, so the result does not depend on memory. Results are written to a ticklab-logs folder as a raw timeline and a Markdown report. python3 ticklab.py --open runs the same segments in a fixed order with the names shown, which is useful for a first look.

Terminal window showing ticklab in open mode, naming the segment Large GPU burst
Open mode names each segment. The blind run hides this on purpose.

What our own blind tests showed

We ran an earlier version of this test on 20 and 23 November, using a different GPU load but the same method. The results:

Load Events Heard
Large GPU bursts 60 27
Small GPU bursts 60 0
All-core CPU bursts 18 4

SSD writes, a single CPU core waking and screen redraws were not heard at all. The large against small comparison gives a one-sided Fisher p-value of about 2 in 10 billion, so chance is not a good explanation. The tick came 0.3 to 0.6 seconds after a large load started, not when it ended, and it came and went from day to day. All-core CPU bursts ticked occasionally and far less often than the GPU.

That is a pattern, not a cause. One hypothesis is a component reacting to the sudden jump in power draw when a heavy load starts, and a software or driver issue is another. We found no source that confirms either for Apple silicon, so both stay hypotheses until a repair diagnosis says otherwise.

An Apple appointment that proved little

On 27 November the Mac went to an Apple support appointment. The full system diagnostic passed, and the tick did not show up there, and the room was loud, with a different and smaller monitor than the one at home. Apple suggested a software reinstall and, before that, a test under a new user account. At home the same day the Mac ticked again, even straight after a restart and with no GPU load running. That is why the home checklist below exists, and why a recording you made yourself is worth more than your description.

The home checklist: hardware or software?

Work through these in order, cheapest first. Run gputick or the blind test at each step and note whether the tick is still there. Record every test with a phone beside the case.

  1. Strip it down. Power, keyboard, mouse and one monitor, nothing else. Run gputick. Silence means a peripheral or a cable is involved.
  2. Another wall socket, ideally in another room and on a different circuit if you can manage it. The MacRumors case above turned on this.
  3. Safe Mode. Apple silicon: choose Shut Down and wait for the screen to go black. Hold the power button until “Loading startup options” appears, select your startup disk, hold Shift and click “Continue in Safe Mode”. To confirm, open System Information and check that Boot Mode says Safe. Apple’s guide: Start up your Mac in safe mode.
  4. A new user account. Create one in System Settings, log out of your main account completely (fully log out, not fast user switching, so the main account’s background jobs stop) and run the test from the new one. Apple suggests this test too.
  5. A clean macOS on a second volume. This gives the same evidence as Apple’s software reinstall without erasing anything. In Disk Utility select your existing APFS volume, choose Edit > Add APFS Volume, name it, and install macOS onto it from the installer (“Show All Disks”, then pick the new volume). Apple’s page is Use more than one version of macOS on Mac, and Eclectic Light has a detailed guide. Eclectic Light warns that a problem in the shared container could affect both systems, so make a backup first. Delete the volume afterwards if you do not want it.
  6. Apple Diagnostics. Shut down, press and hold the power button until startup options appear, then hold Command–D until the Mac restarts. Disconnect everything except keyboard, mouse, display and power first. Apple’s page: Use Apple Diagnostics to test your Mac. A passing result does not rule out a fault, as our own appointment showed.

How to read the result

What you see What it points to
Silent with everything unplugged, loud again with one device attached That device or its cable
Silent on another wall socket Mains supply or earthing at the first socket
Ticks in Safe Mode and in a clean macOS volume Hardware. Take it to Apple with your recordings and the log
Ticks only in your main account Software. Remove login items, background jobs and extensions one at a time

When you contact Apple, bring the phone recordings, the ticklab-logs report and the list of steps you already took. “It ticks 0.3 to 0.6 seconds after a large GPU load starts, and not under a small one” is a far better opening than “it makes a noise sometimes”.

Where this stands

On the Mac Studio this article is based on, home tests for hardware or software are still under way, and the cause is not known. If you run the test and get a clear result, in either direction, that is useful information for other owners. Treat the tool as an instrument and the checklist as a way to narrow things down, not as a diagnosis.

Advertisement

Get the week's tech news by email

One email a week with Trendblog's stories on AI, hardware, apps and crypto.

We'll email you to confirm your address. Unsubscribe any time. Privacy policy