Then set up the emerging threats list with the pf firewall Icefloor is made by Hany El Imam who also made the excellent noobproof and waterroof for previous versions of osx
Then install icefloor the gui frontend for the pf firewall in mountain lion So whenever they try to look at naughty sites they get rickrolled. I used the rickroll hosts trick when setting up a laptop for my mate who didnt want his kids accessing things they shouldnt, by adding a list of unsuitable domains to the hosts file.
You can also use the hosts file to rickroll people, just add the youtube iframe code to the index.html in /Library/WebServer/Documents Let us know in the comments if you have any questions or tips. Generally speaking though, we recommend just using the tools that are built directly into the Mac. That’s it, though again you may need to flush the DNS for changes to take effect.įinally, it’s worth mentioning that if you’d prefer to avoid the Terminal and the command line completely, you could try the easier method of using a preference pane to modify the contents of hosts that way through System Preferences instead. Sudo cp ~/Documents/hosts-backup /private/etc/hosts Then, if you wanted to restore the modified hosts to the backup of the original file, you just have to swap the paths like so and rename the file again: Sudo cp /private/etc/hosts ~/Documents/hosts-backup Making a backup of the hosts file can be a good idea if you plan on making significant changes or just want to play around with modifications and see what happens, a simple way to do that would be to use this command, which would store a backup in your home ~/Documents/ folder:
The following tips go beyond Mac OS X and apply to any hosts file, be it on a Mac, Windows, or Linux. Tips to Consider When Editing Hosts Files Note: the procedure is the same with older versions of Mac OS X, though the path to hosts could be /etc/hosts if the version of Mac OS X is dated significantly.
If you’d like to see how this entire process is accomplished before doing it yourself, watch the video below to see a demonstration of the hosts file being modified on Mac OS X to block the website ‘’ from loading: When flushing DNS cache with that command you will need to enter the admin password. You can verify your hosts modifications immediately with ping, Safari, or any other network app.Ĭhanges take effect immediately though some adjustments may need to be accompanied by a DNS flush which can be done with the following command in macOS 10.12+ through OS X 10.9:ĭscacheutil -flushcache sudo killall -HUP mDNSResponder
We’ll walk through how to manually edit the hosts file in macOS Big Sur, MacOS Mojave, MacOS Catalina, MacOS High Sierra, MacOS Sierra, OS X El Capitan, Yosemite, OS X Lion, OS X Mountain Lion, and OS X Mavericks, this will be done with the command line using the simple text editor called nano.