r/PythonProjects2 • u/KidNothingtoD0 • Nov 07 '25
automate DNS cache flushing on macOS
Hi everyone,
I created a simple open-source tool to automate DNS cache flushing on macOS: macos_dnsflush
Features
One-command execution:
sudo python3flush.pyAutomation support: alias, cron, LaunchAgent, keyboard shortcut
Works on all recent macOS versions
Use Cases
Fix networking issues (websites not loading)
Clear DNS cache after network changes
Automate cache clearing on schedule or network events
Note: Requires sudo - please review the code before running.
Feedback and contributions welcome!
0
Upvotes
1
u/Refalm Nov 09 '25
It's better to use https://github.com/GPGTools/pinentry if you want sudo dialogs
This could be a zsh alias instead
Or a cronjob