Repair /etc/resolver via Applescript automatically
I am using a local dns-server to redirect all *.home-hosts to localhost.
To prevent macOS from always using my local dns-server and only resolving *.home locally, I created a file called home
inside /etc/resolver
containing the string nameserver 127.0.0.1
.
This does not play well with my VPN-client “Forti-Client” which for some reason deletes this file everytime I disconnect from a vpn. To restore this file in a quick manner, I created the following Applescript:
applescript
do shell script "sudo tee /etc/resolver/home >/dev/null <<EOF
nameserver 127.0.0.1
EOF" with administrator privileges
Using Automator, I can then easily add this script to my services-menu to quickly restore that file.
You can download the finished workflow here:
Post-Meta
- Published: July 21, 2019
- Last modified: February 29, 2020
- Tags: apache virtualhosts
Comments