Why Git, Homebrew, and npm Easily Timeout or Disconnect on Remote Mac
Three main reasons:
- Long RTT and packet loss. Cross-border or remote links add latency and loss. Default client timeouts are short; a single slow segment can abort the transfer.
- Small buffers and no retry. Git’s default
http.postBufferis small for large pushes; HTTP clients often don’t retry on transient errors. Homebrew and npm use similar defaults. - No connection reuse. Repeated SSH connections (e.g. for Git over SSH) renegotiate each time. Without ControlPersist, each clone or fetch pays full connection cost and is more exposed to mid-transfer drops.
CI runners on a remote Mac amplify this: many jobs clone and install in parallel, so timeouts and retries become critical for stability. Cross-border teams often see the worst of it when the Mac node and the Git/npm/Homebrew upstream are in different regions.
Git Timeout and Retry: Executable Parameters
Use these globally or per-repo to reduce timeouts and improve retry behavior.
HTTP buffer and low-speed (timeout) rules:
git config --global http.postBuffer 524288000
git config --global http.lowSpeedLimit 1000
git config --global http.lowSpeedTime 60
Explanation: postBuffer 500MB for large pushes; lowSpeedLimit (bytes/s) and lowSpeedTime (seconds) together act as a transfer timeout (e.g. abort if < 1000 B/s for 60s).
Optional HTTP timeout (seconds): git config --global http.version HTTP/1.1 can help on some proxies. For a hard timeout: git config --global http.lowSpeedTime 120 (increase if links are very slow). In CI, set these via git config in the job or in a pre-installed global config on the runner image.
SSH connection reuse (ControlPersist): Add to ~/.ssh/config for your host (e.g. Host github.com):
Host github.com ControlMaster auto ControlPath ~/.ssh/sockets/%r@%h-%p ControlPersist 600
Create the directory: mkdir -p ~/.ssh/sockets. New connections reuse the master for 600 seconds, reducing reconnects and mid-clone failures.
Homebrew and npm Retry and Timeout Configuration
Homebrew. Set retries and (optionally) a faster core remote:
export HOMEBREW_CURL_RETRIES=5 export HOMEBREW_CORE_GIT_REMOTE="https://github.com/Homebrew/homebrew-core.git" # Optional: mirror # export HOMEBREW_BOTTLE_DOMAIN="https://mirror.example.com"
Put exports in ~/.zshrc or your CI env. Increase HOMEBREW_CURL_RETRIES on flaky networks.
npm. Retries and timeouts (e.g. in .npmrc or env):
fetch-retries=5 fetch-retry-mintimeout=20000 fetch-retry-maxtimeout=120000 fetch-timeout=300000
Times are in milliseconds. For CI, a registry mirror or proxy often matters more than tuning these alone; combine with the table below. Put these in project .npmrc or in the CI environment so every run uses the same retry and timeout policy.
Self-Hosted Mirror vs Proxy vs Public Mirror: Comparison
Choose by use case, ops capacity, and cost.
| Option | Best for | Speed / stability | Cost / maintenance |
|---|---|---|---|
| Public mirror site | Quick fix, no ops | Good if region matches | Free; may have rate limits or SLAs |
| Proxy (HTTP/SOCKS) | Unblock + single egress | Depends on proxy location and bandwidth | Proxy cost; minimal app config |
| Self-hosted mirror | Full control, CI-heavy | Best when close to runner | Storage + sync; you maintain |
For remote Mac CI: start with a public mirror or proxy if your runner is cross-border; move to a self-hosted mirror if you need maximum stability and can run sync jobs. See our Git mirror vs proxy guide and cross-border pull acceleration for step-by-step config.
Summary and Recommendations
- Increase Git
http.postBuffer, setlowSpeedLimit/lowSpeedTime, and enable SSH ControlPersist for connection reuse. - Set Homebrew
HOMEBREW_CURL_RETRIESand optionally a core remote or bottle mirror; set npmfetch-retriesand timeouts (and a registry mirror if needed). - Pick mirror vs proxy vs self-hosted from the table above; combine with shallow clone or cache where possible (see our cache strategy post).
- Quick checklist: Git buffer and lowSpeed* set; SSH ControlPersist in place; Homebrew retries and npm retries/timeouts configured; mirror or proxy chosen and applied. Re-run a failing clone or install after each change to confirm.
A stable remote Mac node reduces flaky pulls and CI failures. MacPull provides dedicated Mac Mini (e.g. M4) instances with SSH/VNC, so you get a fixed environment and predictable network from your chosen region. Use the checklist above on your runner, then try our pricing and purchase page or homepage to choose a node—no login required. More guides: blog.
Stable Remote Mac for Git, Homebrew & npm
Rent a Mac Mini M4 for reliable pulls and CI. SSH/VNC included. View pricing and purchase—no login required. Or read more on our blog.