Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jasonmvp

macrumors 6502
Original poster
Jun 15, 2015
422
345
Northern VA
Hey gang -

For ... "reasons" ... (we'll just leave it at that) I need to use the scutil command to change my DNS resolvers. This is doable in an interactive mode; without arguments, scutil kicks you into its own shell of sorts. The question I have is: is there any way to set DNS config bits from scutil without going into the interactive mode? Based on the man page, the only DNS-related thing I can find in non-interactive is the --dns argument. And all that does is show the DNS config.

Any ideas? I've hunted around on the 'net and haven't found much. The only guides I have found all have you going into interactive.

Thanks.
 
Does it have to be scutil? networksetup -setdnsservers will do what you want.
 
Does it have to be scutil? networksetup -setdnsservers will do what you want.

Nope, unfortunately networksetup won't actually do what I want. That only sets the DNS servers that are used in the "Network Location". If, say, a VPN is started, the DNS servers are overwritten and forced into /etc/resolv.conf. It appears that scutil is the only way to change that.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.