everyday mac tools

Setting up a Mac mini as a machine you never sit in front of

· 6 min read

A Mac mini in a cupboard doing one job is a genuinely good arrangement: a build machine, a media server, something that runs a task on a schedule. It is also a machine you cannot walk up to, which changes what setup means.

Three things have to be right before you unplug the monitor: you can reach it, it comes back after a power cut, and it does not go to sleep.

Set up screen sharing before you disconnect anything

Do this while a display is still attached, because configuring remote access remotely is the problem it solves.

System Settings, General, Sharing. Turn on Screen Sharing and Remote Login. Screen Sharing gives you the desktop; Remote Login gives you SSH, which is what you will actually use most.

Note the address it shows, of the form name.local. From another Mac, connect with Command-K in the Finder and vnc://name.local, or open the Screen Sharing application directly.

Test both from another machine now, while you can still plug a monitor back in if something is wrong.

Give it a fixed address

name.local works via Bonjour and is usually reliable on a home network. When it is not, you need an address that does not change.

Easiest is a DHCP reservation on the router, which ties the Mac’s hardware address to a fixed IP. Find the hardware address:

ifconfig en0 | grep ether

Then set the reservation in your router’s settings. This survives reboots on both sides, which a manually configured static address on the Mac does not always do cleanly.

Stop it sleeping

The default power settings will put a headless Mac to sleep and you will conclude it has crashed.

System Settings, Displays, and set Prevent automatic sleeping when the display is off for a desktop on mains power.

Confirm from the command line, which is more explicit:

pmset -g custom

To disable system sleep entirely:

sudo pmset -a sleep 0
sudo pmset -a disksleep 0

Leave display sleep alone; there is no display.

Make it come back after a power cut

The setting people forget, and the one that turns a five-minute outage into a trip home.

sudo pmset -a autorestart 1

That restarts the Mac automatically after a power failure. Confirm it took:

pmset -g | grep autorestart

Also worth setting a scheduled wake if the machine needs to be up at particular times, in System Settings, Energy, or with pmset repeat.

Log in automatically, or do not

The awkward trade.

If FileVault is on, the Mac cannot fully start after a reboot until someone enters the password. That is the entire point of FileVault, and it means an unattended restart leaves the machine sitting at the login screen.

Two honest options. Turn FileVault off on a machine that lives in your house, has nothing sensitive on it, and needs to restart unattended. Or keep FileVault on and accept that a reboot needs you.

There is a third arrangement, using fdesetup authrestart, which unlocks the disk for one restart you initiate:

sudo fdesetup authrestart

That is the right answer for a planned reboot over SSH. It does not help after an unexpected power cut.

Decide deliberately rather than discovering it at the wrong moment. FileVault covers what you give up.

The headless resolution problem

With no display attached, macOS picks a small default resolution, and screen sharing shows a cramped desktop.

The fix is a display emulator, a small dongle that plugs into HDMI and reports a monitor. They cost very little and they resolve it completely. Without one, screen sharing still works and the desktop is smaller than you want.

Keep it maintainable

Two habits that make a headless machine pleasant rather than a liability.

Name it properly, so you know what you are connecting to. Naming a Mac covers it.

Write down what it does and how to reach it. A machine set up in an afternoon and left alone for two years is one you will have forgotten entirely. A note with the address, the account name, and what it runs saves an evening later.

Back it up. Headless machines are the ones that get forgotten. Time Machine to a drive attached to it, or to a network share. Backing up a Mac to a network drive covers the latter.

Questions

Screen sharing is slow. Usually the network rather than the Mac. Wired Ethernet is dramatically better than Wi-Fi for this. Reducing the colour depth in the Screen Sharing application’s settings helps over slow links.

Can I reach it from outside the house? Not directly, and you should not expose screen sharing to the internet. A VPN back to your home network is the sensible route.

Does it need a keyboard and mouse attached? No. Some older Macs complained at boot without one; current machines do not.

What if it stops responding to SSH? Then you need physical access, which is the argument for autorestart and for a machine you can actually reach. A power switch you can toggle remotely is a reasonable backstop.