How to keep iPhones running 24/7 for automation

By Dean Hajjar ·

Set each phone's Auto-Lock to Never, turn off Low Power Mode, keep it charging on a powered USB hub, and save its passcode in iFarm so it can unlock itself. On the Mac, let iFarm keep it awake while phones run, enable start at login and reopen after a crash, and set the idle disconnect to Never. After a phone restarts, unlock it once by hand.

The checklist

Most farm outages come from a handful of things: a phone locked itself, a phone restarted and is waiting for its passcode, the Mac went to sleep, or a cable only charges. Here's everything in one place, then the details.

WhereSettingWhy
PhoneAuto-Lock → NeverA locked phone can't be driven
PhonePasscode saved in iFarm, or no passcode on dedicated phonesiFarm can unlock it by itself
PhoneLow Power Mode offKeeps the phone at normal speed
PhoneCharging, with a charge limit or Optimized Battery ChargingBattery health on a phone that's always plugged in
HardwarePowered USB hub and data cablesPhones charge and stay connected
MaciFarm keeps the Mac awake while neededSchedules don't miss their window
MacStart at login, reopen after a crashiFarm comes back by itself
iFarmIdle disconnect → NeverHelpers don't stop on locked phones
iFarmHealth pageShows problems before they cost you a night

On each phone

Auto-Lock: Never

Settings → Display & Brightness → Auto-Lock → Never. This is the single most important setting. iOS won't let anything drive a locked phone.

The passcode

You have two choices:

The one thing a saved passcode can't do: start the helper on a locked phone. Whenever the helper has to start from scratch (after the phone restarts, after iFarm restarts, or after the helper was stopped for being idle), unlock the phone by hand once. iOS won't start the helper on a locked phone, and iFarm can't type the passcode without it. The phone's tile says Unlock the phone by hand to continue when this happens.

Tip: To make hand-unlocking rare, set the idle disconnect to Never (below) and keep every phone charging, so the helper never has a reason to stop.

Low Power Mode off

Turn it off in Settings → Battery. A phone on charge all day doesn't need it, and it slows the phone down.

Charging and battery health

A farm phone sits on a charger around the clock, so give its battery some help:

Heat

Phones on a shelf, screens on, charging, can get warm. Apple says iPhone works best at 0° to 35° C (32° to 95° F) ambient, that charging in high heat can cause further damage, and that charging inside certain cases may generate excess heat (Apple Batteries). In practice:

  1. Take the phones out of thick cases.
  2. Leave space between them, and keep them out of direct sun.
  3. Keep the room cool. A small fan over the rack is cheap insurance.
  4. Watch battery levels on iFarm's Health page; a phone that keeps losing charge while plugged in usually has a bad cable or port.

Hubs and cables

More detail on choosing hubs and a host Mac: phone farm hardware.

On the Mac

Sleep

While a phone is running, or a schedule or program is on, iFarm keeps the Mac from sleeping on its own. The display can still sleep. This isn't a system setting: it's held by the app and ends the moment iFarm quits. You can switch it off on the Health page. A laptop still sleeps when you close the lid, which is one reason a Mac mini makes a good always-on host.

Start at login and reopen after a crash

On the Health page, press Enable. Move iFarm to your Applications folder first and open it from there. macOS may ask you to approve it in System Settings → General → Login Items. After that, iFarm starts when the Mac does, and if it ever crashes it comes back after 30 seconds. A normal Quit stays quit.

Helper signing renewal

The helper app on each phone is signed with your Apple developer team, and the signature expires: after 7 days on a free Personal Team, after a year on the Apple Developer Program ($99/year). iFarm rebuilds and renews it by itself in the last 3 days, the next time a phone starts. For a farm, the paid program is recommended, simply because there's less to renew.

In iFarm

Idle disconnect

Setup → Preferences → Disconnect a phone after no use for… is 30 minutes by default. It stops an unused helper to save battery. That's fine on your desk, but on a 24/7 farm a stopped helper on a locked phone means unlocking by hand. Set it to Never on phones that are always charging.

Automatic recovery

If a phone's helper crashes or stops answering, iFarm restarts it by itself, waiting longer after each failure (2 s, 5 s, 15 s, 30 s, then 60 s). Unplugging and plugging back in reconnects automatically. During a run, if something gets in the way, iFarm dismisses alerts, taps "Not now" or "Close" buttons, goes back, or reopens the app; if a step still fails, the run stops with a screenshot and the phone is sent Home, so it never sits blocked.

How schedules behave overnight

The Health page

Open Health in the sidebar; its badge counts problems. It shows:

When you need to stop everything

Only run automations on phones dedicated to the farm; a replay taps whatever is on screen, so don't leave one running on a phone someone is using.

Frequently asked questions

Can an iPhone stay on a charger 24/7?

Yes, and a farm phone usually does. On iPhone 15 and later, set a charge limit such as 80%; on older models, keep Optimized Battery Charging on. Keep the phones cool and out of thick cases.

Why does my phone need unlocking by hand after a restart?

iOS won't start iFarm's helper on a locked phone, and iFarm can't type the saved passcode until the helper is running. Unlock it once; after that the saved passcode keeps it unlocked.

Does iFarm change my Mac's sleep settings?

No. It holds the Mac awake from inside the app while phones or schedules need it, and that ends the moment iFarm quits.

What happens to schedules if the Mac was asleep?

Runs that are more than an hour late are skipped. Runs inside their window are retried while a phone is busy or in use.

How often does the helper need re-signing?

Every 7 days on a free Apple developer team, once a year on a paid one. iFarm renews it by itself in the last 3 days, the next time a phone starts.