My laptop's hostname appears to be Georges-MacBook-Pro-Mid-2145.local,

Computers on your local network can access your computer at: Georges-MacBook-Pro-Mid-2145.local

$ hostname

Why is the number reported here 2145 instead of 2015? (I own a MacBook Pro Mid-2015, so I was expecting the host name to be Georges-MacBook-Pro-Mid-2015.local).

Did I do something wrong somewhere while twiddling about in the terminal or is it normal that the last numbers are... "random" (?)

  • It's probably getting that from your local DNS server for some reason; without knowing more it's hard to tell what that reason is. See: MacOS Strange Terminal Prompt, Tried Resetting Terminal. Apr 25 '19 at 0:20
  • The prompt uses the hostname, so the same sources of confusion should apply. Apr 25 '19 at 0:24
  • That's not the point; the point is that the Q&A answer I linked explains why you can get an unexpected hostname; whether you're seeing the weird name via the hostname command or via the shell prompt doesn't matter. Apr 25 '19 at 0:30
  • @GordonDavisson it's using my network provider's DNS server I think. So my computer's hostname can change if I went to someone else's house or something? I never knew this Apr 25 '19 at 0:45
  • @theonlygusti "So my computer's hostname can change if I went to someone else's house or something?" No! Your computer's hostname never changes until you tell it to. Your WiFi network / DNS / whatever does not control the hostname.
    – Dev
    Apr 25 '19 at 1:04

Have you tried clicking the edit button that's right next to the hostname that you want to edit?

Edit button in action

  • I don't want to change the hostname, at least not until I know why it has this value. Apr 25 '19 at 1:07
  • It has that value because you probably made a typo when setting it up, then changed the computer name, and changing the computer name doesn't change the hostname. It's probably simpler than you think and it has nothing to do with what network you're on.
    – Dev
    Apr 25 '19 at 1:16
  • "when setting it up" — when would I have manually set up my own hostname? Apr 25 '19 at 9:40
  • @theonlygusti when setting your computer name for the first time? the hostname is set from that... if you made any typo there but then changed it, the hostname would not have changed on its own, you would have to change the hostname manually
    – Dev
    May 5 '19 at 3:54
  • I'm pretty sure I never had to choose my computer's name when setting it up... May 5 '19 at 15:21

This question is a manifestation of the same situation described in question Why is my host name wrong at the Terminal prompt when connected to a public WiFi network?, and the answer https://apple.stackexchange.com/a/127405/17600 explains the cause and the solution. Copying from that answer:

Type in Terminal:

scutil --get HostName

If there's no HostName available, what you see is probably coming from the DNS or DHCP server.

Set your HostName with:

sudo scutil --set HostName 'yourHostName'

That should do it.


You must log in to answer this question.

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