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

ViViDboarder

macrumors 68040
Original poster
Jun 25, 2008
3,447
2
USA
I just got an iMac and for some reason the host name is "new-host-2" and I would like to change it to something more descriptive.

In my Network Preferences I have changed the computer name to "My iMac" but the host name stays the same. Ideas?
 

calderone

Cancelled
Aug 28, 2009
3,743
352
There are multiple names that you can change.

Here are the commands you need to run to change them, simply put the name you would like in place of newName:

Code:
sudo scutil --set ComputerName newName
Code:
sudo scutil --set HostName newName
Code:
sudo scutil --set LocalHostName newName

You can also see what they are currently set to by replacing --set with --get, And of course do not include any name at the end.
 

ViViDboarder

macrumors 68040
Original poster
Jun 25, 2008
3,447
2
USA
There are multiple names that you can change.

Here are the commands you need to run to change them, simply put the name you would like in place of newName:

Code:
sudo scutil --set ComputerName newName
Code:
sudo scutil --set HostName newName
Code:
sudo scutil --set LocalHostName newName

You can also see what they are currently set to by replacing --set with --get, And of course do not include any name at the end.

Very handy. Thanks. If only I had signal on my iPhone I'd take care of it now.
 

ViViDboarder

macrumors 68040
Original poster
Jun 25, 2008
3,447
2
USA
Hey, so I did this and it worked but I just noticed that my router still picks up my iMac as new-host-# as well as my iPhone, which I ran the same commands on to set a hostname.

I set both local and the regular host names but I have no results. My Macbook Pro shows up just fine though. It gets really annoying setting port forwarding on my router without recognizable hostnames.

Any ideas? Is there a maximum length? Mine is currently 17 chars long but it seems like this would be fine after consulting Google.
 

dyn

macrumors 68030
Aug 8, 2009
2,708
388
.nl
If the dhcp/dns server also provides the hostname you will end up with whatever that dhcp/dns server gives you as a hostname. Check your router, it may still reference your iMac as new-host-# and change it if it does.
 

cameronw

macrumors newbie
Mar 30, 2013
2
0
Try the router itself:

that worked for me - here's some clarification on the steps

Access your router (usually 192.168.1.1 or something) and look for the list of devices. On my Verizon Router this is under "My Network." You should be able to rename them there.

The problem I found was that my computer had two different IP connections to the router: one was the ethernet, the other was the wireless connection. The wireless connection had the correct name, the other one had "new-host-5". You can't have the same name for both, so rename the wireless connection to whatever, and then change the name of the ethernet connection to what you want. (Also I just disabled the Wireless connection, because I don't need both... Don't know if that was necessary though)
Hope This helps!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.