MacOS – Getting [iMac.domain_not_set.invalid ~] in Terminal

macosterminal

When I open up my terminal I now get:

[iMac.domain_not_set.invalid ~ 501]$

In my .bash_profile it says:

export PS1='[\H \W \!]\$ '

Any idea what is going on?

Best Answer

Your hostname is not set correctly. This could be because of the information you set in Sharing in System Preferences, or because the DHCP server gave your system an incorrect hostname to use.

To fix this, change your hostname in Sharing, or in case of a DHCP issue, check the DHCP server configuration.