How can I disable DNS caching in Safari?

12,323

Solution 1

Clear the OS cache:

sudo killall -HUP mDNSResponder

Disable Safari DNS prefetching:

defaults write com.apple.safari WebKitDNSPrefetchingEnabled -boolean false

Solution 2

Update: for Yosemite to clear the cache you want:

sudo discoveryutil udnsflushcaches

Solution 3

In Safari 12.1 this should have been moved to:

defaults read com.apple.Safari WebKitPreferences.dnsPrefetchingEnabled

With:

defaults write com.apple.Safari WebKitPreferences.dnsPrefetchingEnabled -boolean false

you should be able to disable it.

Share:
12,323

Related videos on Youtube

EricKitt
Author by

EricKitt

Updated on September 16, 2022

Comments

  • EricKitt
    EricKitt over 1 year

    I'd like to disable Safari on Mac OS X from performing DNS caching.
    Is there a way to do that through configuration or any other setting ?

  • malhal
    malhal about 8 years
    This defaults write doesn't work on El Capitan, even tried restarting Safari. To test I added a loopback entry for Google to my hosts file and reload in Safari still worked.