Disable built-in DNS clients in Chromium based apps
All Chromium-based apps such a Google Chrome, Obsidian have a built-in DNS client. I have set up NextDNS on my computer to block ads and trackers. The built-in DNS clients by pass the NextDNS, which I don’t want.
On top of built-in DNS is switched on by default, there is no way to switch it off using the UI. I found a way to switch it off using the command line[1].
First, you need the bundle identifier of the Chromium-based app. I have listed bundle identifiers of popular apps towards the end of the page. Otherwise, use the mdls command to get the bundle identifier.
# Run this command in Terminal.app
mdls -name kMDItemCFBundleIdentifier -r <path/to/chromium-app.app>
# Example:
# $ mdls -name kMDItemCFBundleIdentifier \
# -r /Applications/Google\ Chrome.app/
# com.google.Chrome Once you have the bundle identifier, use the defaults command to set BuiltInDnsClientEnabled to false.
# Run this command in Terminal.app
defaults write <bundle-identifier> BuiltInDnsClientEnabled -boolean false
# Example:
# defaults write org.chromium.Chromium \
# BuiltInDnsClientEnabled -boolean false Make sure to restart the app after you run the defaults command. You can use dnsleaktest.com to check which DNS server is used by the Chromium browser.
You can revert to using the built-in DNS client by deleting the BuiltInDnsClientEnabled preference.
# Run this command in Terminal.app
defaults delete <bundle-identifier> BuiltInDnsClientEnabled
# Example:
# defaults delete org.chromium.Chromium \
# BuiltInDnsClientEnabled Popular Chromium Apps
| Application | Bundle Identifier |
|---|---|
| Chromium | org.chromium.Chromium |
| Google Chrome | com.google.Chrome |
| Obsidian | md.obsidian |
| Visual Studio Code | com.microsoft.VSCode |
| Vivaldi Browser | com.vivaldi.Vivaldi |
I learned about this preference from this comment on discourse.pi-hole.net ↩︎