Mac: wrong hostname at the terminal prompt? Here the solution!

Andrés Cecilia Luque
2 min readNov 2, 2018

Today I was setting up a new mac. After playing with it a bit, I opened the terminal, and immediately noticed that the hostname (which appears at the left, on every line) was wrong:

I wanted to change it, and here is how I finally managed.

That host name appearing in the terminal is coming from the DHCP server you are connected to, which means that your router is providing it. The router is taking it from the computer name under the “Sharing” preferences of your mac:

In order to change it you have to do two things:

  • First, change the name under the “Sharing” preferences:
  • Second, force the router to refresh the new hostname that you just configured. In order to do that you have to access the “Network” settings, select “Wifi”, select “Advanced”, go to the “TCP/IP” tab and click on “Renew DHCP Lease”:

After doing that, restart the terminal, and you will see that the hostname is now the right one! 🎉🎉

--

--