Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Akarin

macrumors 6502
Original poster
Oct 16, 2011
290
17
Nyon, Switzerland
Hi all,

When I open terminal, I see this:

terminal.png


Before I used to have "myname's Mac mini:" on the prompt. Now, I always have this "unknown..." line. Anybody knows why and how to fix it?

Thank you!
 

Quad5Ny

macrumors 6502a
Sep 13, 2009
984
22
New York, USA
Does the "hostname" and "whoami" command list the correct info?

Try quitting Terminal completely and then logging on/off of your account.
 

yawns

macrumors member
Oct 12, 2011
89
12
sudo scutil --set HostName NAMEYOUWANT.local

sudo hostname doesn't save between reboots.
 

Akarin

macrumors 6502
Original poster
Oct 16, 2011
290
17
Nyon, Switzerland
I tried both commands above and none of them work. My terminal just enters a mode with a prompt showing this:

>

...and nothing else. Then no command works and I have to quit & re-launch terminal before arriving to the same view as in the original post above. :confused:
 

Phil A.

Moderator emeritus
Apr 2, 2006
5,799
3,094
Shropshire, UK
Wirelessly posted (iPhone 4: Mozilla/5.0 (Linux; U; Android 2.3.3; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1)

Try setting your DHCP client ID to your machine name in network settings and then Renee your DHCP lease.
I've seen this before when a DHCP server updates the DNS server with unknown and the MAC address which then gets used as the hostname.
 

Akarin

macrumors 6502
Original poster
Oct 16, 2011
290
17
Nyon, Switzerland
Wirelessly posted (iPhone 4: Mozilla/5.0 (Linux; U; Android 2.3.3; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1)

Try setting your DHCP client ID to your machine name in network settings and then Renee your DHCP lease.
I've seen this before when a DHCP server updates the DNS server with unknown and the MAC address which then gets used as the hostname.

Although the client ID was blank and I did what you propose, still no joy. Still having the unknown string in terminal...
 

shamalk

macrumors newbie
Mar 4, 2012
3
0
Are you using Ethernet ?

Hi,
I have this problem when I connect my mac book air to Ethernet using the Ethernet to USB adapter.

When I remove Ethernet I get my normal hostname back.

Hope this helps.
 

sidewinder

macrumors 68020
Dec 10, 2008
2,425
130
Northern California
The problem isn't your computer. Phil A. is right. The problem is that is the name you DHCP server is handing you.

Edit your account's ".bash_profile" file and add this to it:

Code:
PS1='$(networksetup -getcomputername):\W \u\$ '

The ".bash_profile" file should be at the root level of your user account. If it is not there, create it.

Now, if you put "8.8.8.8" at the top of your DNS list, I bet your hostname would work fine too.

S-
 

nodnami

macrumors newbie
May 31, 2014
1
0
The problem isn't your computer. Phil A. is right. The problem is that is the name you DHCP server is handing you.

Edit your account's ".bash_profile" file and add this to it:

Code:
PS1='$(networksetup -getcomputername):\W \u\$ '

The ".bash_profile" file should be at the root level of your user account. If it is not there, create it.

Now, if you put "8.8.8.8" at the top of your DNS list, I bet your hostname would work fine too.

S-

I had the same problem and this worked for me.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.