I'm trying to resolve only example1.com and example2.com using a custom DNS server. I've read that scutil could come in handy, but after doing the following, the system-wide DNS is still used:

sudo scutil
> open
> d.init
> d.add ServerAddresses *
> d.add DomainName example1.com
> set State:/Network/Service/PRIMARY_SERVICE_ID/DNS
> quit

Am I missing something?

1 Answer 1


I would not recommend scutil for this -- it's hard to understand and hard to use (and I'm not sure what the commands you've done so far actually do, but I'm pretty sure it's not what you want). The "standard" way to configure custom resolution policies for specific domains is to create a /etc/resolver directory, and then put file(s) in it named for the domain(s) you want the policies applied to. See man 5 resolver and this web page for more info.

In you case, this would mean creating both /etc/resolver/example1.com and /etc/resolver/example2.com, both containing this:


Note: I haven't tested this in a while, but I assume it still works. Also, note that changing /etc/resolv.conf does not change the system resolver's behavior; it's just there for compatibility with unix-heritage tools that depend on it.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .