Sitemap

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

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:

Press enter or click to view image in full size

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:

Press enter or click to view image in full size
Press enter or click to view image in full size

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

  • First, change the name under the “Sharing” preferences:
Press enter or click to view image in full size
  • 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”:
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

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

Press enter or click to view image in full size

--

--

No responses yet