Skip navigation
This discussion is archived

changing computer name

5838 Views 18 Replies Latest reply: Apr 13, 2008 4:44 AM by SteveLamb0 RSS
1 2 Previous Next
counterpt Level 1 Level 1 (5 points)
Currently Being Moderated
Nov 24, 2007 12:17 PM
Hello,

I have a clean install of leopard. I also signed up for the trial .mac account (I'm not sure if this is affecting anything).

I want to change the name of the computer.
So I go to the preference pane and sharing and change the name.
But when I start the terminal, it shows the old compute name:
(old computer name):~ (username)$

Am I missing something. Which computer name is correct what it says in the shell in terminal or what the sharing preference pane is telling me (new name).local

I know I have changed the name successfully in the past few days, I don't know why it's stuck now.

This is the last time I want to change the name! The reason I want to change it is because the old name has my name in it and I don't want to connect to a network and have people identify me (nothing subversive just privacy! I'm a teacher and I don't want students trying to hack my notebook because they realize it's mine).

My account is an admin account.

Thank you for any help.
MacBook Pro 2 GHz core duo, Mac OS X (10.5.1)
  • Topher Kessler Level 6 Level 6 (9,295 points)
    Currently Being Moderated
    Nov 24, 2007 12:19 PM (in response to counterpt)
    You can change the computer name in the "Sharing" Preference Pane at the top in the field labeled "Computer Name". Try fixing permissions to see if that will let the new name implement somewhere. It should change the terminal settings.
    PowerMac G5 dual 2.5GHz, PowerBook G4 1GHz DVI, Mac OS X (10.5.1)
  • Will Bridewell Calculating status...
    Currently Being Moderated
    Nov 24, 2007 1:14 PM (in response to counterpt)
    Hi, I just wanted to mention that I'm having the same problem. I switched computer names in the Sharing pane, but Terminal and xterm both display the old computer name. My computer appears with the correct name on my local network, so I'm not sure how Terminal is getting the old name.
    Mac OS X (10.5.1)
  • Will Bridewell Level 1 Level 1 (5 points)
    Currently Being Moderated
    Nov 24, 2007 1:22 PM (in response to counterpt)
    I've hunted around, and I can think of two things.

    1. Terminal is weird. It doesn't respect the hostname set in the Sharing pane, but if you issue the command

    sudo hostname <new host name>

    quit Terminal, and then reopen the application, the new hostname should appear. From what I can tell, the name in the Sharing pane is the one displayed on the network. I don't know why the two names are disconnected in Leopard.

    2. It may be the case that your computer, when connected to the network, is assigned a hostname by the DHCP server. If so, then you need to contact the system administrator and request that your hostname be changed at the server level.
    Mac OS X (10.5.1)
  • Topher Kessler Level 6 Level 6 (9,295 points)
    Currently Being Moderated
    Nov 24, 2007 1:26 PM (in response to counterpt)
    Where you enter teh computer name, try editing the local name (teh "Edit..." button under the computer name field).
    PowerMac G5 dual 2.5GHz, PowerBook G4 1GHz DVI, Mac OS X (10.5.1)
  • Tim Campbell1 Level 3 Level 3 (570 points)
    Currently Being Moderated
    Nov 24, 2007 1:34 PM (in response to Will Bridewell)
    'Terminal' app is a bit different. The default prompt shows the hostname as it resolve from DNS (or whatever service you use to resolve hostnames).

    You can do a 'man bash' to see the manual page for the bash shell (the man page for bash is very long) and keep paging down until you find the definition of 'PS1' (which is the default host prompt for the bash shell). You can type (in the Terminal window shell prompt) "echo $PS1" to see the current value of the PS1 variable. Mine looks like this:

    \h:\W \u\$

    The "\h" part resolves to display whatever the 'hostname' command would have printed UP TO THE FIRST "." (ie. it wont display the domain name. It's as though you typed 'hostname -s' in the terminal to view the hostname.). If you changed it to "\H" (upper case 'H') then it would display the entire hostname.

    You can use the 'hostname' command to change the hostname, but this will not be saved permanently (if you reboot it will revert back to whatever it was).

    Since the displayed hostname is actually based on DNS (or whatever network name service you happen to use) if someone wanted to contact your computer they could use that name or they could use the the name you provided in the 'Sharing' panel of system preferences.
    MacBook Pro 2.2 & 2.4 GHz 4GB, Mac OS X (10.5.1)
  • Topher Kessler Level 6 Level 6 (9,295 points)
    Currently Being Moderated
    Nov 24, 2007 1:41 PM (in response to Tim Campbell1)
    For me the Terminal echoes whatever I put in the computer name field, regardless of whether or not I'm connected to a network. This guy's problem is that the terminal name is not changing, and I suspect something in his OS X configuration is preventing the computer name he inputs from being written to the configuration file that defines the hostname, so when bash looks up \h for the hostname, it doesnt get a changed value. This behavior is unlike my system, which does change the hostname according to what I type in for the computer name.
    PowerMac G5 dual 2.5GHz, PowerBook G4 1GHz DVI, Mac OS X (10.5.1)
  • Eduardo Rolon Level 1 Level 1 (25 points)
    Currently Being Moderated
    Dec 16, 2007 8:45 AM (in response to counterpt)
    I think it is too late to avoid the reinstall and it will not solve your issue, but you can try the following.

    Go into your network settings and change "using DHCP" from dynamic to "Using DHCP with manual address" input a new address and that should fix it. The culprit is the router that it is pulling the old name therefore forcing the router to clear its "cache" will change the name, also restarting might work. The end result is that having the name be different is of no consequence except to us people that like things neat.
    2.5G5, Mac OS X (10.4)
  • Slawo Calculating status...
    Currently Being Moderated
    Jan 13, 2008 12:49 AM (in response to counterpt)
    Using hostname will not change the host name. The entry in the sharing preferences pane will.
    I actually had to reboot my modem to get the correct host name displaying in the terminal and in the various links in the sharing properties.

    So it was a network issue.
  • bbolin Level 3 Level 3 (520 points)
    Currently Being Moderated
    Jan 13, 2008 8:46 AM (in response to counterpt)
    Changing the host name on a Unix based OS will require starting and stopping the network service or rebooting for it to appear everywhere.
    iMac Alu 20" 2.4ghz | 2GB RAM | iPod touch 8GB, Mac OS X (10.5.1)
  • Russa Level 4 Level 4 (1,315 points)
    Currently Being Moderated
    Jan 13, 2008 9:06 AM (in response to counterpt)
    Are you trying to change the short account name? If so, it cannot be changed. I think this is the name that appears in Terminal.

    You can right click on the name of the hard drive on the desktop and change its name.

    You can go into System Preferences and change the name of the shared device by clicking on "Edit" button in the Sharing window.
    MacBook Pro 15" 2.4GHz with 4Gbytes, Mac OS X (10.5.1), Cox cable, ZyXEL P-330W v1.7, PAP2 v2 for Vonage, G-Drive Q for TM
  • SteveLamb0 Level 5 Level 5 (4,110 points)
    Currently Being Moderated
    Jan 13, 2008 10:42 AM (in response to Russa)
    Hi Russa

    Russa wrote:
    Are you trying to change the short account name? If so, it cannot be changed.


    In Leopard, you can change your shortname but it is to be done with extreme caution.

    System Preferences>Accounts.
    Click padlock & authenticate to unlock (if locked)
    Right-click name of your Admin account in left-hand list.
    Click Advanced Options.

    Stuff you can change:

    UID
    Group ID
    Short Name
    Login Shell
    Home Directory
    UUID
    Aliases

    Like I said, this requires extreme caution (read warning at top of that window).
    Intel iMac 17" 1.83Ghz Combo Drive, 2GB RAM, 160GB HDD, Mac OS X (10.5.1), LaCie Writemaster, Voyager 210 Router, Maxtor Basics 3200 500GB
1 2 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.