Browsing the web in Safari on macOS only to be halted by the error message: ‘Safari cannot open the page because the network connection was lost’ or ‘The network connection was lost (NSURLErrorDomain: -1005)’ disrupts productivity, particularly when other applications (such as Slack or Spotify) continue accessing the internet without issue. In macOS network architecture, Safari routes web requests through WebKit networking daemons, system proxy filters, and Transport Layer Security (TLS) sockets. When TCP socket resets occur, DNS responder caches become stale, or iCloud Private Relay encounters packet drops, Safari terminates active HTTP connections.
Why Does Safari Lose Network Connections?
The -1005 connection lost error occurs when an open TCP socket is abruptly closed by an intermediary or host:
- iCloud Private Relay Packet Drops: Apple’s dual-hop encrypted proxy encountering latency spikes or geographic exit-node failures.
- Corrupted Local mDNSResponder DNS Cache: Stale IP address mappings causing WebKit sockets to route requests to dead endpoints.
- Third-Party Content Blockers or VPN Extensions: Network extensions abruptly terminating keep-alive HTTP/2 or HTTP/3 TCP sessions.
- Corrupted Network Configuration Plists: Damaged network interface preference files in
/Library/Preferences/SystemConfiguration/. - IPv6 MTU Packet Fragmentation: Router MTU mismatches causing packet dropouts over IPv6 tunnels.
Step 1: Temporarily Disable iCloud Private Relay
iCloud Private Relay is the leading cause of sudden connection termination in Safari on modern macOS releases.
- Click the Apple menu and open System Settings.
- Click your Apple Account / Apple ID at the top of the sidebar.
- Click iCloud, then scroll down and select Private Relay.
- Toggle Private Relay Off (choose Turn Off Until Tomorrow or Turn Off Private Relay).
- Return to Safari and reload the webpage to see if direct routing succeeds.
Step 2: Flush the macOS DNS Cache via Terminal
Purging stale domain name system cache forces macOS to establish clean socket connections.
- Press Cmd + Space, type
Terminal, and press Enter. - Execute the following command to flush the mDNSResponder cache:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Enter your Mac user password when prompted and press Enter.
- Restart Safari and test browsing.
Step 3: Clear Safari Website Data and Cache
Corrupted cached HTTP/2 connection tokens can cause servers to reject ongoing TCP requests.
- In Safari, click Safari in the top menu bar and select Settings (or Preferences).
- Go to the Privacy tab and click Manage Website Data.
- Click Remove All to purge accumulated session tokens.
- Next, press Cmd + Option + E to empty the WebKit developer caches.
Step 4: Disable Safari Extensions and Content Blockers
Ad blockers and security extensions often terminate keep-alive connections prematurely.
- Open Safari > Settings > Extensions.
- Uncheck all active extensions (especially ad blockers, VPNs, and antivirus shields).
- Reload the failing webpage. If the page loads instantly, re-enable extensions one by one to identify the faulty plugin.
Step 5: Renew DHCP Lease and Configure Custom DNS
Re-establishing your local network lease resolves TCP reset loops.
- Open System Settings > Wi-Fi.
- Click Details next to your connected Wi-Fi network.
- Select the TCP/IP tab and click Renew DHCP Lease.
- Switch to the DNS tab:
- Click the + (plus) button and add Cloudflare DNS:
1.1.1.1and1.0.0.1. - Or Google Public DNS:
8.8.8.8and8.8.4.4.
- Click the + (plus) button and add Cloudflare DNS:
- Click OK and apply changes.
Disabling iCloud Private Relay, flushing the mDNSResponder DNS cache, and configuring reliable DNS resolvers eliminates the ‘Safari network connection was lost’ error on Mac.