Is it possible to disable the network in iOS Simulator?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
The iOS Simulator does not have a built-in airplane mode toggle or network disable switch. It shares the host Mac's network stack directly. To simulate offline conditions, you either disable networking on the Mac itself, use Network Link Conditioner to throttle bandwidth to zero, or architect your app with a network abstraction layer that can be toggled in test builds.
Why the Simulator Has No Airplane Mode
Physical iOS devices manage their own cellular radio, Wi-Fi chip, and Bluetooth hardware. Airplane mode is a hardware-level toggle. The Simulator is a user-space process running on macOS. It does not emulate network hardware. Instead, it uses the host Mac's TCP/IP stack directly. Any network request from a simulated app goes through the Mac's network interfaces. This means there is no way to disable networking for the Simulator alone without affecting the entire Mac.
Method 1: Disable the Mac's Network Interface
The most direct approach is to turn off networking on the Mac. This affects everything on the machine, not just the Simulator.
Using the Menu Bar
Click the Wi-Fi icon in the menu bar and select "Turn Wi-Fi Off." If you are connected via Ethernet, unplug the cable.
Using the Command Line
Using a Script with Automatic Restore
For testing sessions, wrap the disable/enable cycle in a script:
The downside is obvious: you lose internet access on the Mac for the duration of the test. IDE features, package managers, documentation lookup, and any other network-dependent tools will stop working.
Method 2: Network Link Conditioner
Network Link Conditioner (NLC) is an Apple developer tool that intercepts network traffic and applies configurable constraints like latency, bandwidth limits, and packet loss. While it cannot completely disable the network in a binary sense, it can simulate conditions so degraded that they are functionally equivalent to offline.
Installing Network Link Conditioner
NLC is distributed as part of the "Additional Tools for Xcode" package:
- Open Xcode > Settings > Components.
- Or download from developer.apple.com/download/more and search "Additional Tools."
- Install the Network Link Conditioner preference pane from the downloaded DMG.
Once installed, it appears in System Settings > Network Link Conditioner.
Creating a Custom "Offline" Profile
- Open Network Link Conditioner in System Settings.
- Click "Manage Profiles" then click the "+" button.
- Configure the profile:
| Parameter | Downlink | Uplink |
| Bandwidth | 0 kbps | 0 kbps |
| Packets Dropped | 100% | 100% |
| Delay | 0 ms | 0 ms |
- Name it "100% Packet Loss" and save.
- Select the profile and toggle NLC on.
With this profile active, all network requests from the Simulator (and the Mac) will time out. The TCP connections will technically be attempted but every packet is dropped, so your app sees connection timeouts and network errors identical to a real offline scenario.
Using NLC from the Command Line
Method 3: Application-Level Network Mocking
The most precise approach does not touch the system network at all. Instead, you inject a mock network layer into your app during testing.
URLProtocol Stubbing
Register a custom URLProtocol subclass that intercepts all requests and returns errors:
Using a Launch Argument Toggle
Configure your app to check a launch argument that enables offline mode:
Then pass the argument in your Xcode scheme under "Arguments Passed On Launch" or in UI tests:
This approach is the only one that affects the Simulator exclusively without disrupting the Mac's connectivity.
Method 4: Proxy-Based Network Control
Tools like Charles Proxy or mitmproxy can intercept Simulator traffic and selectively block requests.
Configure the Simulator to use the proxy by setting the HTTP proxy in System Settings > Wi-Fi > Advanced > Proxies on the Mac (since the Simulator inherits the Mac's proxy settings).
Comparison of Approaches
| Method | Scope | Simulator-only | Precision | Setup effort |
| Disable Mac Wi-Fi | System-wide | No | Binary on/off | None |
| Network Link Conditioner | System-wide | No | Configurable (latency, loss, bandwidth) | Low |
| URLProtocol stubbing | App-level | Yes | Full control per request | Medium |
| Proxy (Charles/mitmproxy) | System-wide or app-scoped | Partially (via proxy config) | Per-request blocking | Medium |
| NWPathMonitor override | App-level | Yes | Status reporting only | Low |
Testing Network Transitions
Beyond testing pure offline behavior, you should also test transitions between online and offline states. Real users move in and out of connectivity.
To test this in the Simulator, use Network Link Conditioner and toggle it on/off during a running session. Your NWPathMonitor callbacks will fire just as they would on a real device.
Common Pitfalls
Assuming NWPathMonitor reflects Simulator-specific state. Since the Simulator uses the Mac's network, NWPathMonitor reports the Mac's connectivity status. If you disable Wi-Fi on the Mac, the monitor correctly reports .unsatisfied. But there is no way to make the monitor report offline while the Mac is online, short of using the URLProtocol approach.
Testing only the offline state, not the recovery. Users do not stay offline permanently. Test that your app recovers gracefully when connectivity returns: pending requests retry, cached data refreshes, and UI updates from an error state back to normal.
Using Reachability libraries that only check interface availability. Many legacy Reachability wrappers check whether a network interface is available, not whether a specific host is reachable. In the Simulator, the interface is always "available" even if Network Link Conditioner is dropping all packets. Test with actual HTTP requests, not just reachability checks.
Forgetting to re-enable Network Link Conditioner. NLC persists across reboots. Leaving a "100% Packet Loss" profile active will break all networking on your Mac until you disable it. Consider adding a reminder or using the command-line approach that resets on reboot.
Summary
The iOS Simulator cannot disable networking independently because it shares the Mac's network stack. For quick manual testing, disable Mac Wi-Fi or use Network Link Conditioner with a 100% packet loss profile. For precise, repeatable, Simulator-only offline testing, implement a URLProtocol subclass that intercepts requests and returns offline errors, toggled via a launch argument. This application-level approach is the only method that does not disrupt the Mac's own connectivity and can be integrated into automated UI test suites.
Related reading
- Is it possible to evenly distribute buttons across the width of a LinearLayout
- Is it possible to have multiple styles inside a TextView?
- Is it possible to have placeholders in strings.xml for runtime values?
- Is it possible to install iOS 6 SDK on Xcode 5?
- Is it possible to execute code once before all tests run?
- Is it possible to mark springboot tests so they run only when certain profile is active
- Is it possible to institute a timeout for SKStoreProductViewController loadProductWithParameters?
- Is it possible to obtain a dynamic table view section header height using Auto Layout?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.