On macOS, the equivalent of ipconfig /flushdns is executed via Terminal using commands like sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder depending on your macOS version.

Steps to Flush DNS Cache

  1. Open Terminal
    Press Command (⌘) + Space to open Spotlight, type Terminal, and press Enter to launch the Terminal app freeCodeCamp.orgfreeCodeCamp.org.
  2. Determine Your macOS Version
    Click the Apple icon → About This Mac → note the version number and name. The command to flush DNS varies by version freeCodeCamp.orgfreeCodeCamp.org+1.
  3. Enter the Appropriate Command
    • macOS Big Sur (11) and later, including Sequoia and Sonoma:
      sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
      
      This command clears both the DNS cache and forces the mDNSResponder process to reload osxhub.comosxhub.com+1.
    • macOS El Capitan (10.11) through Catalina (10.15):
      sudo killall -HUP mDNSResponder
      
      This simpler command is sufficient for older versions osxhub.comosxhub.com.
  4. Authenticate
    After pressing Enter, you will be prompted to type your admin password. Terminal will not show characters as you type; this is normal OS X DailyOS X Daily+1.
  5. Verify (Optional)
    You can check if the DNS cache has been cleared by testing connectivity to a website or using commands like dig or nslookup to confirm updated DNS resolution osxhub.comosxhub.com.

Optional: Automate with AppleScript

You can create a small Automator application to run the flush command without typing it each time:

  • Open Automator → New → Application → Add Run AppleScript → paste the flush command.
  • Save and run the app whenever you need to clear DNS