I don't know how long ago this happened, but today I realized that when I open up terminal it no longer says
Matthew-MacBook:~matthew$
as it used to. Instead, it appears to have synched up with my roommate's macbook pro. It now displays:
$Gabriels-MBP:~matthew$
I've restarted my mac but it doesn't change the name.
I've tried the suggestions suggested in these posts
sudo scutil --set HostName Matthew-Macbook
But no effect!
echo "$PS1"
returns \h:\W \u\$
Best Answer
I know this is late, but the solution here may work for others with similar roommates.
I am thinking that your hostname is properly set, but that your prompt definition may have been pranked.
First check is to run 'echo $PROMPT && echo $PS1' and see if they match. If they don't, then we are looking for a prompt re-definition for sure but it is worthwhile to investigate fully anyways.
The terminal prompt is defined in several places and I suggest you look at them all for alterations
I am assuming that you use bash as your shell based on the output from your echo command. When I went to Mojave I switched to zsh, but I kept my bash settings. This following is from my previous master file.
# ==============
/private/etc/profile
Last edited: 2019/07/08
Bash first reads and executes commands from the file /etc/profile, if that file exists. From that file it calls (appends) /private/etc/bashrc, the System-wide bashrc file for interactive bash(1) shells. That bashrc checks if bash is interactive, then sets windowsize parms, and then appends Apple terminal definitions before returning control to here
After reading those files, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
# ================
You should look at /private/etc/profile and /private/etc/bashrc as system wide prompts can be set there.
Also look at the ~/.bash_profile, ~/.bash_login, and ~/.profile files as they are the final place your prompt is set.
In general you are looking statements along the lines of: PS1=' some set of esc sequences like '\n and '\u mixed with the chars like '$' or '@''
PROMPT= the same as just above.
If you see Gabiel's name in any of those files then that is the one to change.
I would look at these files in reverse order.
If you are interested, putting the following would give you a nice terminal front based on a Green on Black Homebrew profile for you, root, and you as sudo -s. Of course you could modify it as you see fit as the colours are defined too. Copy following to the end of /private/etc/profile:
# declare ANSI color codes VARs
# end colour VARs
# set colour prompt
# end set prompt