3

My terminal prompt on OS X 10.8.3 suddenly is not the machine or hostname anymore but something like:

minint-j4lfb2s:~

Where does that come from? I did not change it. How can that be?

gronostaj
  • 55,965
  • 20
  • 120
  • 179
Joe D
  • 31
  • 2
  • What does your `sudo nano /private/etc/hosts` says? – mirkobrankovic May 30 '13 at 13:24
  • Never touched that. It has the default entries I guess - (127.0.0.1 localhost, 255.255.255.255 broadcast, ::1 localhost, fe80::1%lo0 localhost) – Joe D May 30 '13 at 13:39
  • Figured out now, that it always happens when I am sitting in the office (of my new client). Is that a nt-domain thing? Is that normal? Back home everthing is fine again. – Joe D Jun 05 '13 at 07:47

2 Answers2

0

I've seen this happen on a few macs (including my own once), where the mac's "Computer Name"/"Local Hostname" gets corrupted.

Check System Preferences -> Sharing, and seem what the "Computer Name" text box. Then check the text under that to see if the "Local Hostname" is correct; if not, click the "Edit..." button to it's right.

demure
  • 6,080
  • 1
  • 27
  • 29
  • "Computer name" and hostname - both present and correct. Hostname equals computer name plus ".local". – Joe D May 30 '13 at 13:42
0

The hostname can also be determined by a reverse DNS lookup (see this thread).

You can set a static hostname with sudo scutil --set HostName newname. It adds or changes the System:System:Hostname key in /Library/Preferences/SystemConfiguration/preferences.plist. Another way is to add HOSTNAME=newname to /etc/hostconfig.

Related questions:

Lri
  • 40,894
  • 7
  • 119
  • 157
  • I am sure there are ways to set a hostname. Right now I am just scared and wonder how it happend. And where this cryptic name comes from - where is it defined. E.g. the key in the preferences.plist you mention is correct - it shows the same as in the System preferences. – Joe D May 30 '13 at 19:49
  • I have had the same issue today. What was the reason in your case? I am also freaked out a little, since I am afraid someone might have obtained an access to my mac – Ahmadov Nov 10 '17 at 14:18