Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have about 100 users with Mac Books on which I have admin access. I have set up a dnsmasq DNS-Server on a Linux box that has the Domain "schoolnet". Now I have the problem, that all Mac Books have a ComputerName and a LocalHostName (which is the same as ComputerName but with "-" instead of space), but no HostName defined.

On the network they all register with the hostname "localhost" I would like them to have the same HostName as their LocalHostName.

How could I achieve that with a scutil command I could send to them?

share|improve this question

This can be done rather easily, programatically.

COMPUTERNAME="$(scutil --get LocalHostName)" && scutil --set HostName $COMPUTERNAME

Here we set COMPUTERNAME variable to the value contained in LocalHostName, and sets the HostName accordingly.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.