I have a local network at home. This network contains 5 laptops. One of the laptops is Apple laptop with macOS 10.8 on it. The other has a Linux installed, all other runs Windows.

When trying to open my router and check "Connected devices", under the IP address of this Mac I see following:

Host Name - some IPV6 address

What I'd rather prefer to see is some meaningful name so that I can use that in the /etc/hosts file in Linux laptop. And also I'd like to check the computer name so that the /etc/hosts line was proper.


Setting the Mac hostname or computer name from the terminal

  1. Open a terminal.
  2. Type the following command to change the primary hostname of your Mac:
    This is your fully qualified hostname, for example myMac.domain.com

    sudo scutil --set HostName <new host name>
  3. Type the following command to change the Bonjour hostname of your Mac:
    This is the name usable on the local network, for example myMac.local.

    sudo scutil --set LocalHostName <new host name>
  4. If you also want to change the computer name, type the following command:
    This is the user-friendly computer name you see in Finder, for example myMac.

    sudo scutil --set ComputerName <new name>
  5. Flush the DNS cache by typing:

    dscacheutil -flushcache
  6. Restart your Mac.

| improve this answer | |
  • after doing this I still see the IPv6 address in the router. Any idea? And what would be the line in the /etc/hosts file on Linux if I set the hostnames to MyMac? – Igor Jun 24 '17 at 16:37
  • 1
    Always attribute quoted content with an appropriate source link and use quote formatting for quoted content. I've added a potential source link but please edit if this is incorrect. – grg Jun 24 '17 at 22:10

You can set the computer name in System Preferences → Sharing.

| improve this answer | |
  • @ggarside, I still see an IPv6 as a computer name inside the router. It is a Comcast modem/router one. Any idea? – Igor Jun 25 '17 at 1:25

You must log in to answer this question.

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