I was not able to refuse changing my hostname by DHCP Server on Mac Book. None of these solutions below worked for me:

After deleting the files as suggested from the Apple engineer it retrieved a new hostname and a new ip. But it wasn't a static hostname. Creating the file /etc/hostconfig doesn't work neither.

I mean come on, that's a well known feature and it should work. Poorly it doesn't for now. I'm sure there must be a solution for this.

As the server we are using a Mac Mini with built-in DNS and DHCP. My Mac Book's system is macOS Sierra 10.12.3

Edit: From the 3rd link, the Apple engineer suggested to delete the following three files in /Libray/Preferences/SystemConfiguration:


2 Answers 2


It took a LOT of Googling and digging to get this, but I finally found a solution that works. DHCP overrides the LocalHostName system property, but not the HostName property. By default the HostName is not set in macOS Sierra, so you can set it as well as LocalHostName and ComputerName using scutil:

sudo scutil --set HostName yourcomputername
sudo scutil --set LocalHostName yourcomputername
sudo scutil --set ComputerName "Your Computer name"

The HostName property appears to be permanent. LocalHostName can still be overridden, but it won't override HostName once it's set.

  • Well, I think both solutions would do it. As I prefer the bash, I used your solution. The hostname isnot changed anymore after a few reboots.
    – alpham8
    Mar 6, 2017 at 14:58
  • This only works temporarily for me. A few days later I'm back to "Thomas David Baker's Macbook Pro". Can't figure it out. May 25, 2021 at 15:55

Open /System/Library/LaunchDaemons/com.apple.discoveryd.plist with Xcode and add to the ‘ProgramArguments’ array with the string --no-namechange. Save the file and restart the machine.

  • com.apple.discoveryd.plist as well as /usr/libexec/discoveryd only exist in some Yosemite releases (10.10.0-10.10.3)....
    – klanomath
    Mar 2, 2017 at 2:37
  • This file doesn't exist on macOS 11.3.1 – is there a new equivalent? May 25, 2021 at 15:56

You must log in to answer this question.

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