Three times in four months, every hosted CI job in my private repositories failed to start. GitHub reported a spending limit before any tests ran. I had used up the monthly allowance, much of it on macOS builds. Our small team ships iOS apps, and we already had a Mac mini with Xcode that did other work. Moving CI onto it solved the allowance problem. It also made me responsible for failures I hadn't encountered on hosted runners. Once, the machine hit a process limit that prevented even an SSH shell from starting. Disk cleanup needed more care than I had given it, too. Why the minutes run out On 17 November 2026, GitHub's billing docs list $12 of included Actions compute per month on the Free plan. A standard 2-core Linux runner costs $0.006 a minute; a 3 or 4-core macOS runner costs $0.062. That allowance covers 2,000 Linux minutes or about 193 macOS minutes. Self-hosted runners do not draw on it, and standard hosted runners are free for public repositories. Larger runners have separate charges. At 20 minutes per build-and-test job, the allowance covers nine full macOS runs a month across all the account's private repositories. Without a payment method on file, GitHub blocks hosted jobs when that allowance runs out. So I stopped using hosted macOS for private repos. The mini already had Xcode and spare capacity. GitHub announced a $0.002 per minute charge for self-hosted runners on 16 December 2025, then postponed it within days. The billing docs still call this usage free. I keep an eye on that policy because it was part of the reason for moving. One runner per repo, on a machine that does other work GitHub's docs describe shared runners only at the organization and enterprise levels. A personal account registers a runner against a single repository, so each repo gets its own runner directory and its own label, and the workflow targets it with runs-on: [self-hosted, macOS, myrepo-ci]. That is more directories than I would like, but a stuck job in one repo does not block the others. The runner is a launchd job, and because the mini does other work I add two keys to its plist: ProcessType Background LowPriorityIO The launchd.plist man page says Background jobs get resource limits meant to keep them from disrupting the user experience, and LowPriorityIO lowers the job's file system I/O priority. A test job that normally takes 22 to 35 minutes took 63 to 95 on a busy day, and I cannot separate these keys from plain CPU contention. I accept the slowdown. Each workflow also gets a concurrency block: concurrency: group: ci-${{ github.ref }} cancel-in-progress: true With one runner per repo, five quick pushes to a pull request queue five full builds, so a new push cancels the stale run. On main I sometimes want every run to finish, and cancel-in-progress: ${{ github.event_name == 'pull_request' }} does that. Security on a self-hosted runner GitHub warns that untrusted workflow code can leave a self-hosted runner compromised after the job ends. Our setup assumes that workflow code comes from our small team. A private repository alone does not establish that trust; access and pull-request settings still matter. This is the template I start from: permissions: contents: read jobs: test: runs-on: [self-hosted, macOS, myrepo-ci] steps: - uses: actions/checkout@ # v7 with: persist-credentials: false permissions: contents: read. New repositories in a personal account default to a read-only token, but older ones can still be on the permissive setting. I want the file to say it either way. persist-credentials: false. Checkout normally configures credentials for later git commands and removes them during post-job cleanup. Since v6 it uses a separate file under the runner's temp directory rather than storing the token directly in .git/config. Our jobs never push, so I disable persistence as well. Actions pinned to a full commit SHA, with the tag in a trailing comment. A tag can move to different code. A commit pin keeps the workflow on the revision I selected; I still have to trust and review that revision. Only GitHub-owned actions, set in the repository's Actions settings. Linters such as SwiftLint are installed on the machine ahead of time, because an install step would run third-party code with the runner's access. GitHub can also reject any action not pinned to a full SHA; I pin by hand and have not switched that on. Some older workflows still use tags, and I am migrating them. No pull_request_target. It runs with the base repository's token and secrets, and the guide says workflows with that trigger must not check out untrusted code. Checkout v7 now refuses a fork's pull request under it unless you opt in. I kept the runners under my existing user account. That avoids maintaining a second simulator set, but gives workflow code access to that user's files and credentials. A dedicated CI user would reduce that exposure; the settings above do not provide the same isolation. I accepted the tradeoff for this trusted-team setup. If a repo goes public, an outside contributor gets access, or a workflow needs a third-party action, I move the job to an ephemeral machine or a hosted runner. Simulators and the process limit Each job creates its own simulator, named with the run ID, and shuts it down and deletes it in an if: always() step. During one failure, CI cleanup never ran and SSH returned "exec request failed". The machine had reached its per-user process limit. sysctl kern.maxprocperuid prints 2666 on my laptop, but the CI mini allowed 1333. Each booted simulator used roughly 215 process slots there, before the extra processes for a test job. Five simulators from CI and manual testing, all under the same user, exhausted the limit. The machine could no longer start either the cleanup process or the shell I needed to intervene. The fix is admission control. Before booting a simulator, take a machine-wide lock, count what the user is running, and boot only if there is room. Boot while still holding the lock, so the next job sees the simulator you just started. A trimmed version: #!/bin/bash set -euo pipefail udid=$1 cap=$(ulimit -u) job_cost=300 # rough cost of a booted simulator plus a test run reserve=150 # headroom for shells and cleanup max_booted=3 lock="$HOME/.locks/sim-boot" mkdir -p "${lock%/*}" until mkdir "$lock" 2>/dev/null; do sleep 10; done trap 'rm -rf "$lock"' EXIT listing=$(ps -u "$(id -un)" -o comm=) || { echo "cannot count, not booting" >&2; exit 1; } procs=0 sims=0 while IFS= read -r name; do procs=$((procs + 1)) if [[ "${name##*/}" == launchd_sim ]]; then sims=$((sims + 1)); fi done &2 exit 1 fi I capture the ps output, check its exit status and count in bash. A failed counting command must not leave an empty value that later arithmetic treats as zero. Under process pressure, that would make a full machine look idle. The lock also needs an owner and a recovery policy. My version records the holder's PID and reclaims a lock whose holder is gone or that is ten minutes old. That age rule has a risk: reclaiming a lock while its owner is still booting a simulator would admit two jobs at once. The trimmed example omits recovery and would wait forever behind a killed job. It needs that work before use in a real workflow. The script only boots; whoever booted a simulator shuts it down. I test the real script against fake ps and xcrun programs on the PATH, so no simulator boots. The cases: room, too many processes, too many simulators, a failing ps. Disk du over-counts on APFS I wrote a 512 MB random file and made four copies with cp -c, which creates APFS clones. du reported about 2.5 GB for the directory. Free space from df dropped by only about 44 MB, on a busy disk. At larger scale, du once reported 344 GB for a folder of browser code-signing clones on my laptop, and deleting all 472 of them freed about 1.5 GB. I now decide with df. A directory's mtime is not activity My first cleaner was a scheduled find -mmin over the top-level build folders. A directory's mtime changes only when entries are added or removed directly inside it, so in a scratch folder find -mmin +60 still listed a top-level directory as old after I wrote a file two levels down. A long build writing deep in DerivedData could lose its files mid-run. I wrote a failing test for that, then replaced the cleaner with one that checks every descendant's mtime, open files and the owning process before deleting anything. /tmp is not a retention policy Test result bundles are kept for at least a week, and I first put them under /private/tmp. macOS runs a daily job at midnight (com.apple.tmp_cleaner, which calls a shell script you can read) that deletes files there when their atime, mtime and ctime are all older than three days. Because find -atime +3 counts whole days, that means four or more. My seven-day retention was silently four to five days. Two cheap guards The first step of every job refuses to start if free space is below a threshold or cannot be read: avail_kb=$(df -Pk /System/Volumes/Data | awk 'NR == 2 { print $4 }') [[ "$avail_kb" =~ ^[0-9]+$ ]] || { echo "cannot measure free space"; exit 1; } (( avail_kb >= 8 * 1024 * 1024 )) || { echo "under 8 GB free"; exit 1; } The second is a watchdog. A runner once crashed when the disk filled up and it could not write its own log. It sat offline for about eight hours, with a job waiting in the queue, before I noticed. A small script on a 15-minute timer restarts a runner whose listener has died and alerts me if that does not bring it back. It only watches the runners on its list, so each new runner has to be added by hand. Where this is worse than hosted A hosted runner is a clean VM every time. Mine accumulates state, from simulator runtimes to tools I installed once and forgot. A job can pass here because of something installed by hand and fail on a fresh machine. I maintain all of it, and I have not added up the hours. One machine is also one point of failure. When it is off, CI is off. If your private repos fit in about 193 macOS minutes a month, or the repo is public, use hosted runners. Before adding CI to a shared Mac, check sysctl kern.maxprocperuid and measure the process count with one simulator running. Leave enough headroom for your other work and for the shell you'll need when a job fails. Sources checked on 17 November 2026 Actions billing: https://docs.github.com/en/billing/concepts/product-billing/github-actions Runner pricing: https://docs.github.com/en/billing/reference/actions-runner-pricing Secure use reference: https://docs.github.com/en/actions/reference/security/secure-use Actions settings for a repository: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository GitHub Changelog, "Update to GitHub Actions pricing", 16 December 2025: https://github.blog/changelog/2025-12-16-coming-soon-simpler-pricing-and-a-better-experience-for-github-actions/ actions/checkout changelog (v6, v7): https://github.com/actions/checkout/blob/main/CHANGELOG.md
Running iOS CI on a Mac mini you already own
Full Article
Original Source
Read the full article at Hackernoon →KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.