3

When I open the terminal on my Mac, this is what it shows:

australia:~ rod$

I don't live in Australia, don't have anything to do with Australia, nor have ever setup terminal as Australia.

Where does that name come from, why is it there, what does it mean and how do I change it (or should I even change it at all)?

slhck
  • 228,104
Prostak
  • 387

5 Answers5

6

Usually the name you see there is your hostname, that is the name of your Mac. Type hostname in the shell to see your full hostname. Note that it might be assigned by DHCP.

DarkDust
  • 1,563
  • when I type hostname, it gives me australia.dev.make-interactive.com Why is it assigned to this name? I never allowed it explicitly. – Prostak Dec 22 '11 at 19:28
  • DHCP assigned it as part of giving you an IP address. – bmargulies Dec 22 '11 at 19:34
  • 1
    Like I said, it could be assigned to you to by a DHCP server (a service that gives each computer an IP address, tells it the IP address of the router, maybe some servers, etc. pp.) You don't need to allow it explicitly though you can turn it off by deactivating DHCP in the System Preferences.app and setting all the relevant data manually. – DarkDust Dec 22 '11 at 19:34
  • @DarkDust - how do deactivate it? And if I do, will it cause any kind of network problems? – Prostak Dec 22 '11 at 19:38
  • Yes, it might cause problems. If you don't know the details of your network you shouldn't mess with it. If you're in a company network talk to your admin. If it's your own net: start System Preferences, go to Network (I have to guess the english terms, my language is German) and select your primary network interface (if you have only one with a green dot: that's the one). Click on More options, select TCP/IP and in the Configure IPV4 drop down box select Manually. Enter the network details. Press OK, the back button (arrow) and then Shares. Here you can change the compute name. – DarkDust Dec 22 '11 at 19:50
  • @DarkDust - ok, I went there, and under local it is set 'automatic'. My computer name is always constant, why doesn't Mac use my computer name instead? Why does it vary based on IP? – Prostak Dec 22 '11 at 19:52
  • I need to repeat myself: it was likely assigned by your DHCP server. – DarkDust Dec 22 '11 at 21:25
6

Usually when you open the terminal is showing the hostname of the computer, you can update that with:

$ sudo scutil --set HostName "<new name>"

The quotes are required. --set also takes ComputerName and LocalHostName.

You might have to do it after an OS X update, where the hostname might change to "authorize-fd8888" (or similar).

To verify, type:

$ hostname

to double check the change.

jww
  • 12,146
  • 46
  • 125
  • 210
LowvaPrg
  • 377
  • what do the hostname mean? shouldn't it be just my root folder? – Prostak Dec 22 '11 at 19:29
  • Hostname is the human-readable name of your computer. Your default Mac OSX prompt has three pieces of info: hostname (australia), current directory (~), and username (rod). – Amadan Dec 22 '11 at 19:37
  • But I never named my computer as australia. Where is it being pulled from? – Prostak Dec 22 '11 at 19:42
  • did you try those commands at the terminal @Prostak ? – LowvaPrg Dec 22 '11 at 19:43
  • @LowvaPrg, not yet. I am cautious to change it before I understand what it does and what it might cause. If it is pulled by DHCP, where is the preference on my Mac that controls it? – Prostak Dec 22 '11 at 19:45
3

I believe you're either receiving it with your DHCP settings, or whoever configured your Mac OS X set it for you. Take a look at System Preferences -> Internet & Wireless -> Sharing -> Computer Name. If you're not receiving it from DHCP, you can set it there.

Amadan
  • 1,867
  • When I go to System Preferences -> Internet & Wireless -> Sharing -> Computer Name, it shows my regular computer name. Nothing about australia. How do I check whether it is pulled from DHCP? – Prostak Dec 22 '11 at 19:39
  • 1
    That's the thing - the fact that your preferences don't match, and the fact that your full hostname is australia.dev.make-interactive.com, suggest pretty strongly that it comes from your ISP's DHCP. You can take a look at this article to see how hostname is determined: DHCP, if not then DNS, if not then System Prefs, if not then localhost. – Amadan Dec 22 '11 at 19:45
  • why is it important that the hostname is dynamically generated based on my ip? My computer name is always constant, why doesn't Mac use my computer name instead? – Prostak Dec 22 '11 at 19:49
  • In short, because your DHCP server tells it to, and your computer is set to use it by default. There was a tiny bit of info in the linked article about what to do about it, but it is deprecated; if you follow the trail (like, finding this article), you will find @LowvaPrg's solution on how to change this default. – Amadan Dec 22 '11 at 19:57
  • does it mean, that other computers on the same network will have different names? So this name assigned randomly by DHCP? – Prostak Dec 22 '11 at 20:54
  • Semirandomly. Usually, DHCP, as long as it has capacity, will try to remember who it gave which name to. But if it has 255 available slots and 300 users, every now and then it won't have a choice but to assign you a new name. So it depends on how your ISP manages its business. – Amadan Dec 22 '11 at 20:57
  • Why does it change it? Since all computer's names are random anyway, why is it important to overwrite names. – Prostak Dec 22 '11 at 21:03
  • You misunderstand. It tries to keep it same, as long as possible. They're not random, someone made up a list: one for each public-facing IP that they are allotted. Let's say they have 256 public IPs: one for the router, and 255 for the customers. Each of the public IPs has its own name. The IP you are currently assigned to happens to be australia.dev.make-interactive.com. You will keep this name as long as possible. If there is ever a situation where you are not connected, 254 other users are (leaving australia free), and another user that isn't you connects, – Amadan Dec 22 '11 at 21:13
  • DHCP would not have any choice but to reassign australia to him. Some ISPs will not sign up more users than they have IPs; however, since a lot of people are only occasionally online, a greedier company will count on some people being offline, so that their IPs get reused. The reason why DHCP tries to preserve your IP address is so that if you're running a server, say, a web-server, people around the world can type in australia.dev.make-interactive.com and get to your machine (and not a random one in your neighbourhood). – Amadan Dec 22 '11 at 21:16
2

As others have pointed out, "australia" is your computer's hostname and is likely assigned to you via DHCP.

Your question also asks how you can change your prompt. This is easier than changing your computer's name.

There are other questions on SuperUser discussing how to change your prompt -- such as "Is it possible to change my terminal window prompt text?" or this one.

Doug Harris
  • 27,811
1

The name is your computer's hostname, which is sometimes, but not necessarily always the same as the name you gave it when you set it up for the first time. It does sound as though you have been given another hostname by DHCP. The hostname is one of the optional settings that a DHCP server can assign, but does not have to.

DHCP is a protocol that is used for a computer to ask a DHCP server on the same network to tell it all the settings needed to connect to that network, instead of entering them manually. Without it, you would be unable to connect to a network without knowing how to configure your computer with an IP address, subnet mask, default gateway, DNS servers and other settings that would work with your particular network. If you don't understand what those terms mean, that's exactly the point I'm making.

I've had experience of the DCHP server running on Windows 2K server assigning to macs the hostname of the previous Windows XP workstation that had been using the same IP address. (The sysadmins told me that was because the mac DHCP client was broken. I have my doubts.)