Why is my Mac unable to connect to network
I was debugging some iOS apps with Charles Proxy and Charles froze on my Mac. I assume this was symptom of general network problem, so I rebooted my Mac and confirmed that it wasn’t able to connect to any web sites via web browsers or any apps.
The macOS network utilities (in /System/Library/CoreServices/Applications) worked fine, but command line apps like traceroute
fail with no useful diagnostics or error messages. Neither WiFi nor wired connection work, though other devices on the network were fine. I rebooted all my network hardware, checked for firmware updates, ran Mac hardware diagnostics (by rebooting while holding down the d key), etc., and the problem persists with no promising leads. The only glimmer of hope is that when I use tethered connection via my iPhone, that works (!).
What is going on?
After of literal hours of debugging, I discovered that Charles Proxy was not symptom of a broader problem, but rather it was the problem (even though I rebooted several times and Charles was no longer running).
After hours of debugging, I spent a little time mentally backtracking and thinking about when the problem first manifested itself, and remembered Charles. So, I decided to fire up Charles and the network was suddenly restored. And when I quit Charles gracefully, it restored everything to a stable state. Lol.
Clearly, when it froze on me, it left my networking configuration in some internally inconsistent state. But restarting Charles and quitting it gracefully allowed it to restore my computer to an operable state again.
That’s six hours of my life that I’ll never get back. I write this post to hopefully save someone the pain and anguish I just went through.
(FWIW, this is not a criticism of Charles. It’s an invaluable tool, like WireShark, for debugging networking code. I love Charles, but I guess one needs to be careful if it ever freezes on you. This was the first time it has locked up on me in my many years of using it, so it’s clearly a fairly isolated problem. In retrospect, the solution seems obvious, but, OMG, what a painful learning experience.)