MacOS Strange Terminal Prompt, Tried Resetting Terminal

What you’re seeing is normal, just a bit confusing. It’s the computer’s hostname. The standard prompt includes it in an attempt to be helpful.

In the unix command-line interface, it’s normal to switch to other directories (with cd), other user accounts (with su or sudo), and even other computers (with ssh). Keeping track of where you are can get confusing, so the standard shell prompt includes where and who you are (the computer’s hostname, current username, and current directory); sort of the command-line equivalent of a GPS system.

The problem is that the way it determines the computer’s hostname sometimes causes more confusion than anything else. The process goes a bit like this:

Bash shell: I need to include the hostname in the command prompt. “Hey, operating system: what’s the hostname of this computer we’re on?”

OS: My hostname? Gosh, I wonder what that is. I know, I’ll ask the DNS (domain name service) server if it has a name for my IP address. “Hey, DNS, what’s the name associated with 2.2.79.41?”

DNS server: 2.2.79.41? That doesn’t really have a specific name, it’s just part of the pool of addresses the DHCP server hands out to computers that connect to the engineering network. Oooh, I know, I’ll call it engr2-2-79-41-dhcp. It’s better than nothing, right?”

(There’s a variant of this where the DNS server has a note that, three years ago, the DHCP server handed that IP address to something that gave its name as “Fred’s Android phone”, and it assumes that same device must surely still be there, so it uses freds-android-phone.lan or something similar.)

…so the DNS sends that name to the OS, which passes it to the shell, which displays it in your prompt, which causes you to say “WTF is that????”.

Keep in mind here: every part of this process is something trying to do the best it can to provide the best information it can. Nothing is actually wrong, it’s just rather confusing if you don’t know what it’s doing or why.

Which brings me to your problem with git commands: this is not causing it. It is almost certainly not related to it. Ignore the weird prompt, and troubleshoot your git setup.

Leave a Comment