Changing DNS servers isn’t something most people need to do frequently. When you do need to change them up, though, it takes too many clicks in System Preferences. Use
networksetup at the command line instead. For example, to change your DNS server to the OpenDNS servers, issue the following (if you’re using Ethernet):
sudo networksetup -setdnsservers Ethernet 22.214.171.124 126.96.36.199
To get a list of all the network services you could be using, run
If you make a lot of changes to your network throughout the day, it’s worth getting to know what
networksetup can do. And don’t forget that any command you can run in a shell can be incorporated into an AppleScript or Automator workflow with
do shell script.