NetworkSetup -setdnsservers Did not work

I have used command below in Terminal:

networksetup -setdnsservers Wi-Fi ...

But return:

** Error: Unable to commit changes to network database.

I try add sudo before command, but the result is still the same.

How can I fix this?



MacBook Air (M2, 2022)

Posted on Mar 25, 2025 6:40 PM

Reply
3 replies
Sort By: 

Mar 26, 2025 4:34 PM in response to zeyu32

On a just reset MacBook Pro running Sequoia 15.3.2, I opened Terminal and entered the following command from the initial admin account:


networksetup -setdnsservers WiFi 8.8.8.8 8.8.4.4


This worked as expected. No sudo required. Are you an admin? I did not try on standard account.

Reply

Mar 26, 2025 6:52 PM in response to Strontium90

Thanks for your support first!

I have tried both admin and standard user account,but the result was the same.

I think it might not be a permission issue.

It Performed like the network service has borken by some software?

I have installed a VPN software before, but already uninstalled yet.

Reply

Mar 27, 2025 9:21 AM in response to zeyu32

By any chance did you rename your network interface? We are assuming you are using the default name of Wi-Fi. Try running this command:


networksetup -listallnetworkservices


Do you see Wi-Fi listed?


Next, if you really think the network settings are a mess, and you can easily recreate everything, you can trash the network config plist, reboot, and start over. The file you want to trash is:


/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist


Save all you work, move that file to the Trash and immediately reboot the machine. On reboot, the system will poll the available hardware and reconstruct the NetworkInterfaces.plist file.


Hope this helps





Reply

NetworkSetup -setdnsservers Did not work

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.