Flush the macOS DNS cache
Build a paste-ready command, then review its compatibility and effects before running it.
sudo dscacheutil -flushcache && sudo killall -HUP mDNSRespondercautionrequires privilegeswrite Compatibility
macOSVerified for macOS using zsh, bash syntax.
Operational knowledgereview due 2027-01-19
Requirementsdscacheutildscacheutil must be installed and available on PATH.Elevated accessReview the exact scope before using an elevated account.
Version supportdscacheutil Current supported releasesVerified for macos using zsh, bash syntax; consult compatibility notes for platform-specific differences.
Expected signals(no terminal output on success)Representative successful output; values vary with the selected target and system state.
Known errorsdscacheutil: command not founddscacheutil is missing or is not available on PATH.Permission deniedThe current identity does not have the required access.
Verifysudo dscacheutil -flushcache && sudo killall -HUP mDNSResponderRe-run the corresponding read-only inspection and confirm the intended state.Rollback noteNo universal automatic rollback is available. Capture the current state and use the tool-specific recovery procedure before applying changes.
Command breakdown
01sudoPrivilege elevationRuns the following command with elevated privileges after authorization.
02dscacheutilCommandRuns the dscacheutil stage of this one-liner.
03-flushcacheOptionConfigures dscacheutil with the -flushcache option.
04&&Conditional operatorRuns the next command only when the previous command succeeds.
05sudoPrivilege elevationRuns the following command with elevated privileges after authorization.
06killallCommandRuns the killall stage of this one-liner.
07-HUPOptionConfigures killall with the -HUP option.
08mDNSResponderArgumentPasses mDNSResponder to killall.
Example input
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
Example output
(no terminal output on success)
The macOS DNS caches are flushed and mDNSResponder reloads.
Illustrative output — exact values vary by system and data.
Runbooks
Official sources