Clear the DNS Cache on macOS With Terminal

An old DNS cache can send a Mac to an outdated website address even after the site has moved. Clear it in Terminal with sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder, then reopen the site that was failing.

That command applies to modern macOS versions, including Tahoe, Sequoia, and Sonoma, on Macs with Intel or Apple silicon processors. It refreshes saved website addresses without deleting your files, browser history, or Wi-Fi passwords.

Run the two commands in Terminal

DNS connects a website name with its network address. Clearing the cache makes the Mac request that information again instead of continuing to use its saved copy.

Use this when a particular site won't load, reaches an old server, or started failing after its DNS records changed. I'd try this before changing the Mac's DNS servers, because it leaves your network settings alone.

Drawing of Mac Terminal showing the two DNS cache commands on separate lines
  1. Open Finder > Applications > Utilities > Terminal. Or press Command-Space, type Terminal, and press Return.
  2. Enter sudo dscacheutil -flushcache and press Return.
  3. Type your Mac administrator password when Terminal asks for it, then press Return.
  4. Enter sudo killall -HUP mDNSResponder and press Return. Enter the password again if requested.

The one-line command in the introduction runs those same two commands in sequence. Use either approach; you don't need another reset afterward.

Terminal doesn't display the password characters, dots, or a moving cursor while you type. Keep typing normally. Use the password for your Mac login account with administrator rights, instead of the password used for your Apple Account.

Both commands usually finish without a success message. When Terminal returns to its prompt without an error, move to the website check. Silence is normal; a second run isn't needed.

Reopen the failing site and check what changed

Quit the browser with Command-Q, open it again, and visit the exact address that failed. Don't judge the result from a different website: the point is to see whether a fresh lookup fixes that particular name.

If the correct site now opens, the refresh did what you needed. A daily DNS flush serves no useful purpose. Cached addresses normally save time, and macOS replaces them as their records expire.

Compare the failed site in a second browser on your Mac. If it opens there, check the first browser's settings, extensions, and saved site data. That suggests the problem is in the first browser rather than your Mac's connection.

Try the same site on your phone using the same Wi-Fi, then with Wi-Fi switched off. A failure on both devices over Wi-Fi that disappears on cellular points to your home network or its DNS service. Check those next.

That comparison matters after a website migration. Clearing your Mac can't make the website owner's DNS records change sooner, or force another DNS server to discard information it still considers valid.

Match the command to an older Mac

The command pair used here covers macOS Catalina 10.15 and later. The security vendor's Mac DNS instructions list different commands for older systems.

For El Capitan 10.11 through Mojave 10.14, use sudo killall -HUP mDNSResponder. That is also the listed command for Lion 10.7 through Mavericks 10.9.

For Leopard 10.5 and Snow Leopard 10.6, the command is sudo dscacheutil -flushcache. Tiger 10.4 uses lookupd -flushcache instead. You don't need to run the modern pair on those releases.

Yosemite is the awkward case because its DNS service changed during the release's lifetime. Check the exact 10.10 version before following old instructions, and avoid running a collection of commands intended for different DNS services.

Choose Apple menu > About This Mac to see the macOS name and version. The processor doesn't change the modern command: an Intel Mac running a supported modern release uses the same pair as an Apple silicon Mac.

Handle a password or command error

A rejected password leaves the command without permission to run. Check Caps Lock and the active keyboard layout, then retype the local administrator password. The cache hasn't been cleared if the password wasn't accepted.

If sudo says your account lacks permission, an administrator needs to run the command. For an organization-managed Mac, ask IT to run the DNS refresh or check the managed network settings.

For a command-not-found error, compare the spelling and punctuation with the example. mDNSResponder is one name. Keep -HUP attached to its hyphen.

If a no-matching-process error appears, don't try broader process commands. Check the macOS version and give the exact error to support; the DNS service wasn't running as expected.

Check DNS settings when flushing doesn't help

A cache refresh and a DNS server change solve different problems. Flushing discards saved answers. Changing servers chooses who answers future requests, which can affect work networks, parental controls, and access to internal websites.

On recent macOS, open Apple menu > System Settings > Network, select the network service, click Details, then DNS. Apple's DNS settings instructions describe the server and search-domain fields.

On older releases, the route is System Preferences > Network, your connection, Advanced > DNS. Review the existing settings before making changes, especially if a VPN supplies company addresses.

For network-wide failures, the router DNS guide covers changing the service for the household. Keep that separate from a Mac-only stale address, which doesn't require changing the settings for every device.

If the Mac actually disconnects from Wi-Fi, follow the MacBook Wi-Fi fixes instead. A DNS flush can't repair a dropped wireless connection or create an internet connection the router doesn't have.

If a site opens the wrong destination across devices and connections, give its operator the domain, old destination, and time of the change. For a work-only failure, give IT the hostname, VPN state, and Terminal result for a DNS check.

The Short Version

Run the modern command pair once, enter the Mac administrator password, and reopen the failing site. Silence from Terminal is normal. If nothing changes, compare browsers and networks before changing DNS settings.

Checked December 2, 2026.

If you have any business, I can build it online

Hi, I’m Hamza. I’ve been building websites and online shops for business owners since 2019, and I also built this site you’re reading.

Tell me what business you have or what you’re working on. I’ll look into how much it can grow online, and then we talk. You don’t have to buy anything or hire me first.

Chat with me on my site and I’ll show you proof of businesses I’ve helped and how they’ve grown.

Written by Isaac Smith

Isaac Smith is the founder and editor of PC Glance, a website that covers computers, laptops, and technology. He is a tech enthusiast and a computer geek who loves to share his insights and help his readers make smart choices when buying tech gadgets or laptops. He is always curious and updated about the latest tech trends.

More from Isaac Smith

Leave a Comment