Resetting the DNS cache on OS XEdit

Sometimes a process will claim that a host is unknown when trying to connect with one process (eg. git push) but others have no trouble doing so (eg. ping). The solution may be to bounce the DNS cache.

Working as of macOS High Sierra:

sudo killall -HUP mDNSResponder
sudo killall mDNSResponderHelper
sudo dscacheutil -flushcache


Older notes

The finessed approach

$ sudo launchctl unload -w /System/Library/LaunchDaemons/
$ sudo launchctl load -w /System/Library/LaunchDaemons/

Verified to work on OS X 10.11.2 El Capitan.


Via brute force

$ sudo killall -HUP mDNSResponder


See also