terminal not showing machine's name. Why?

Discussion in 'Mac OS X Lion (10.7)' started by Akarin, Nov 9, 2011.

  1. macrumors 6502

    Akarin

    Joined:
    Oct 16, 2011
    Location:
    Nyon, Switzerland
    #1
    Hi all,

    When I open terminal, I see this:

    [​IMG]

    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!
     
  2. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #2
    Have you looked at what the "Computer Name" is set to in "Sharing" preferences?

    S-
     
  3. thread starter macrumors 6502

    Akarin

    Joined:
    Oct 16, 2011
    Location:
    Nyon, Switzerland
    #3
    Yes... It's set on "MyName's Mac mini".
     
  4. macrumors 6502a

    Joined:
    Sep 13, 2009
    #4
    Does the "hostname" and "whoami" command list the correct info?

    Try quitting Terminal completely and then logging on/off of your account.
     
  5. thread starter macrumors 6502

    Akarin

    Joined:
    Oct 16, 2011
    Location:
    Nyon, Switzerland
    #5
    This is what I get with those two commands, after logging off and back on:

    [​IMG]
     
  6. macrumors regular

    Macopotamus

    Joined:
    Jun 22, 2010
    #6
    Try setting the hostname again with "sudo hostname -s MacName"
     
  7. macrumors member

    Joined:
    Oct 12, 2011
    #7
    sudo scutil --set HostName NAMEYOUWANT.local

    sudo hostname doesn't save between reboots.
     
  8. thread starter macrumors 6502

    Akarin

    Joined:
    Oct 16, 2011
    Location:
    Nyon, Switzerland
    #8
    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:
     
  9. macrumors 601

    Phil A.

    Joined:
    Apr 2, 2006
    Location:
    Telford, UK
    #9
    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.
     
  10. thread starter macrumors 6502

    Akarin

    Joined:
    Oct 16, 2011
    Location:
    Nyon, Switzerland
    #10
    Although the client ID was blank and I did what you propose, still no joy. Still having the unknown string in terminal...
     
  11. macrumors 68040

    Grimace

    Joined:
    Feb 17, 2003
    Location:
    with Hamburglar.
    #11
    I think Lion changed the name from something you name it to your MAC address. Check your Network settings and it probably matches up.
     
  12. macrumors newbie

    Joined:
    Mar 4, 2012
    #12
    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.
     
  13. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #13
    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-
     
  14. macrumors newbie

    Joined:
    May 31, 2014
    #14
    I had the same problem and this worked for me.
     

Share This Page