How to change DNS on Mac OS X with a click

I needed to use particular dns and would change them quickly (with a click)
here is how i did it:
First, here command for make modification by terminal:
sudo networksetup -setdnsservers <networkservice> DNS1, DNS2, DNS3

How to obtain a list of your network services:
networksetup -listallnetworkservices
you will obtain outcome like below:
networklist
In my case i have to change Wi-fi dns, so (as example i’ve used Google dns 8.8.8.8 and 8.8.8.4 ), opening  terminal and running the following command , DNS will be changed:
“sudo networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.8.4”

But how to run it with a click ? using Apple script : open it and insert the following commands :
scriptdnsFirst row executes the command described above , while second line brings up a message that tells us that the command was executed (clearly is optional) .
After that save as application and work is ended; a click will be enough to change your dns
applicationHere is the result after clicking (you will be prompted for the root password )
dnsupdate
Looking Dns section we can see that they have been modified
dnsresults

This entry was posted in Mac Os. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *