What is this called on macOS?


#1

Given the following terminal on macOS:

What is “Kennys-MacBook-Pro”? Is it the host name?

And how do I change it?


#2

System Preferences -> Sharing, change the Computer name.

From the terminal line:
sudo scutil --set HostName ImANewHostname


#3

I’d always thought it was the name of whoever was logged in, but I’m not in front of my mac to be able to check at the moment.


#4

Computer name or host name?


#5

Yes.


#6

Changing the computer name didn’t alter what was displayed in the terminal. I’ll try changing the host name on Monday (it’s a work machine).


#7

Well if you’ve got access to a terminal window, put the commandline one in.

Also you do need to restart the terminal window to see any changes.


#8

Ok, ta. I’ll give it a go on Monday.


#9

It’s the host name. I always change it because it always exposes my real name. So I just change it to a generic name like El Capitan or Mojave. To add in spaces in the new host name, enclose the word in double quotes.


#11

Do macs have anything like linux’ .profile files? Where you don’t bother changing the username/hostname but simply the prompt?


#12

From what I read, Stomme, macs overwrite their profile files at boot with what’s kept by scutil, but I don’t own a mac so I can’t test this random internet research.


#13

Yes, but .profile and .bash_profile are both are usually for startup commands from my experience. Whereas with the host name, you can do it by just changing the terminal. Also, .profile doesn’t exist so you have to create it yourself. I believe .bash_profile does exist. And as far as I know, changing the prompt name does change the host name as well since they tie together.