The DNS (Domain Name Server) is responsible for converting numerical IP addresses into readable domains. If your DNS isn’t setup correctly, then your Mac may struggle to load any websites.
If you’ve encountering DNS lookup errors, or it seems to be taking much longer to access certain web domains, then it’s possible the problem may lay with your DNS cache. A corrupted DNS cache can prevent certain servers and domains from being resolved correctly, so you’ll need to clear your DNS cache before your Mac can load these websites properly.
You may also need to reset your local DNS cache if you’ve recently made changes to your DNS settings but those changes haven’t taken affect.
Before resetting your cache, just be aware that this process may temporarily interrupt your Internet connection, so avoid resetting the cache when performing actions that rely on a stable and reliable network connection, for example when you’re midway through downloading a large file, or chatting to someone on Skype.
Resetting your DNS cache from the Terminal
In High Sierra, you can reset the DNS cache by targeting the mDNSResponder process, using your Mac’s Terminal:
- Open a new Finder window, and navigate to ‘Applications > Utilities.’
- Double-click the Terminal application. This will launch a new window, where you can enter Terminal commands.
- Copy/paste the following command into the Terminal:
sudo killall -HUP mDNSResponder
- Press the ‘Enter’ key on your keyboard.
- Enter your admin password when prompted
- After resetting the cache, you may need to quit and then relaunch some Internet-connected applications, before these applications acknowledge the DNS changes.
If you’re not running macOS High Sierra, then you’ll need to use a different Terminal command.
For macOS versions 10.10.0–10.10.3, use the following:
sudo discoveryutil mdnsflushcache
For macOS versions 10.5–10.6, use the following:
sudo dscacheutil -flushcache
Deleting the regular cache
If you’re encountering strange behaviour when trying to access certain websites, then it may help to delete your regular Safari cache. This requires you to uncover Safari’s hidden ‘Develop’ menu, if you haven’t already:
- Launch the Safari web browser.
- Select ‘Safari > Preferences..’ from the Safari menu bar.
- Select the ‘Advanced’ tab.
- Click ‘Show Develop menu in menu bar.’
- Close Safari’s ‘Preferences’ menu.
- You should now notice a new ‘Develop’ option in the menu bar; select it and then click ‘Empty Caches.’
- Depending on the size of your cache, this can take a few minutes, so you may need to be patient!
- Once the cache has been cleared, close and then relaunch Safari to make sure these changes have taken effect.
Speed Up Your Mac in 3 Easy StepsiDoctor will improve your Mac performance and make it run almost as fast as it was when you bought it.
- Download & Install iDoctor
- Diagnose your Mac for problems
- Remove all items safely