Fixing macOS terminal ‘@UNKNOWN’ error (HostName not Set)

Sim City LTD
2 min readJan 20, 2021

--

tldr: mac terminal host name brokey

Anyways, a few days into a clean install of Big Sur*, and shortly after my first ever Medium post, my terminal has decided it no longer likes it’s name.

*this happened in Catalina also.

I don’t believe that I’ve caused this, however if I find out the root cause and it was me (or anything else) I will update this post accordingly.

To the issue:

before (left) — @Tim-Apple | after (right) @UNKNOWN

After reading through the article here which is a deep dive into all the different system naming in macOS, I checked each name suggested and found that in the WINS tab my NetBIOS name has changed to UNKNOWN:

The article describes that this is self assigned and cannot be changed :(

However, I then proceeded to check the host name, and after running the below it looks like I’ve found the problem:

scutil --get HostName
HostName: not set — how strange?

To resolve this, you can run:

sudo scutil --set HostName "Tim-Apple"

You’ll need to enter your password after, and then viola, once you restart terminal your newly set name should be there:

Hopefully this is helpful for anyone running into the same issue as I was struggling to find a direct answer when googling.

I’ve still got a second line support call with Apple later this week, so if I have an update on the root cause of this I’ll update the article accordingly.

Thanks for reading and I hope you have a wonderful day :)

--

--

Sim City LTD
Sim City LTD

Written by Sim City LTD

welcome to my personal stack overflow

Responses (1)