A comprehensive system-level website blocking solution for macOS that blocks websites at the network level, making them inaccessible through any browser or application.
- Hosts File Blocking: Redirects blocked websites to localhost
- Simple GUI: Easy-to-use interface for managing blocked sites
- Real-time Status: Check if websites are actually blocked
- Automatic Backups: Creates backups before making changes
- DNS Cache Flushing: Automatically flushes DNS cache after changes
- Multiple Blocking Methods:
- Hosts file blocking
- Packet filter (pfctl) blocking
- Combined blocking for maximum effectiveness
- Scheduled Blocking: Set up time-based blocking schedules
- Network Monitoring: Real-time network statistics and monitoring
- Web Interface: Manage blocks through a web browser
- Advanced Settings: Custom pfctl rules, DNS configuration
- Comprehensive Logging: Track blocked attempts and network activity
Unlike browser extensions, this application blocks websites at the system level by:
- Hosts File Modification: Adds entries to
/etc/hoststhat redirect blocked domains to127.0.0.1 - Packet Filter Rules: Uses macOS's built-in
pfctlto block network packets - DNS Cache Management: Flushes DNS cache to ensure immediate effect
- Universal Blocking: Works across all browsers, applications, and network tools
- Bypass-Proof: Cannot be circumvented by using different browsers or incognito mode
- System Integration: Integrates with macOS networking stack
- Persistent: Survives browser restarts and system reboots
- macOS: 10.12 (Sierra) or later
- Python: 3.6 or later
- Administrator Privileges: Required for system file modification
- Internet Connection: For initial setup and dependency installation
- Download or clone this repository
- Open Terminal and navigate to the project directory
- Run the installation script:
chmod +x install.sh ./install.sh
-
Install Python dependencies:
pip3 install -r requirements.txt
-
Make scripts executable:
chmod +x *.py -
Run the launcher:
python3 launcher.py
- Desktop Shortcut: Double-click the "WebsiteBlocker" icon on your desktop
- Applications Folder: Run
/Applications/WebsiteBlocker/WebsiteBlocker.command - Terminal: Navigate to the installation directory and run
python3 launcher.py
- Launch: Choose between Basic or Advanced version
- Add Websites: Enter URLs to block (e.g.,
facebook.com,youtube.com) - Apply Blocks: Click "Apply Blocks" to activate blocking
- Verify: Use "Refresh Status" to verify websites are blocked
- Remove: Use "Remove All Blocks" or "Remove Selected" to unblock
- Set specific times and days for blocking
- Configure duration for temporary blocks
- Automatic activation and deactivation
- Real-time connection monitoring
- Blocked attempt tracking
- Network statistics export
- Access via
http://localhost:8080 - Remote management capabilities
- Mobile-friendly interface
- Hosts File: Fast and reliable, works immediately
- Packet Filter: More comprehensive, blocks at network level
- Both: Maximum effectiveness with redundancy
- pfctl Rules: Add custom packet filter rules
- DNS Servers: Configure custom DNS servers
- Backup Settings: Automatic backup configuration
- Solution: Run with administrator privileges
- Command:
sudo python3 launcher.py
- Check if blocking is actually applied
- Clear browser cache and cookies
- Flush DNS cache manually:
sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder
- Check Python installation:
python3 --version - Install dependencies:
pip3 install -r requirements.txt - Check system requirements
sudo cat /etc/hosts | grep -i "website blocker"nslookup blocked-website.comsudo pfctl -s rulesBlocker/
├── website_blocker.py # Basic version
├── advanced_blocker.py # Advanced version
├── launcher.py # Application launcher
├── requirements.txt # Python dependencies
├── install.sh # Installation script
├── uninstall.sh # Uninstallation script
└── README.md # This file
- Fork the repository
- Create a feature branch
- Implement your changes
- Test thoroughly
- Submit a pull request
- This application requires administrator privileges
- It modifies system files (
/etc/hosts,/etc/pf.conf) - Always backup your system before installation
- No data is sent to external servers
- All configuration is stored locally
- Network monitoring data stays on your machine
- Use automatic backups
- Test blocking on non-critical websites first
- Keep the application updated
- Monitor system logs for issues
- Adds entries like
127.0.0.1 facebook.comto/etc/hosts - Redirects DNS resolution to localhost
- Immediate effect after DNS cache flush
- Uses macOS's built-in packet filter (
pfctl) - Blocks network packets at the kernel level
- More comprehensive but requires system restart
- Automatically flushes DNS cache after changes
- Uses
dscacheutilandmDNSResponder - Ensures immediate effect of blocking
We welcome contributions! Please see our contributing guidelines:
- Bug Reports: Use GitHub issues with detailed information
- Feature Requests: Describe the feature and its use case
- Code Contributions: Follow the existing code style
- Documentation: Help improve this README and other docs
This project is licensed under the MIT License - see the LICENSE file for details.
This software is provided "as is" without warranty. Use at your own risk. The authors are not responsible for any damage to your system or data. Always backup your system before making changes.
- Check this README for common solutions
- Search GitHub Issues for similar problems
- Create a new issue with detailed information
- Include system information (macOS version, Python version, error messages)
When reporting issues, please include:
- macOS version
- Python version
- Error messages
- Steps to reproduce
- System logs (if relevant)
- Monitor the GitHub repository for new releases
- Check the application's built-in update checker
- Subscribe to release notifications
- Download the latest version
- Run the uninstall script:
./uninstall.sh - Run the install script:
./install.sh - Your configuration will be preserved
Suraj Van Verma
- LinkedIn: https://www.linkedin.com/in/bythebug
Made with ❤️ for macOS users who want true system-level website blocking