Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 28 lines (20 sloc) 614 Bytes
set -eo pipefail
# Get /etc/hosts file to block ads at the networking level
curl -s > /tmp/adblock
# Re-write Windows to Unix line endings
tr -d '\r' < /tmp/adblock > /tmp/etchosts
comment() {
replace " $1" "# $1" /tmp/etchosts
# Comment-out used hosts
comment ''
comment ''
comment ''
# Add /etc/hosts overrides
echo '# MacOS default broadcasthost' >> /tmp/etchosts
# Update /etc/hosts
sudo mv /tmp/etchosts /etc/hosts
# Flush DNS cache
sudo killall -HUP mDNSResponder
You can’t perform that action at this time.