Terminal shows hostname from old machine, not new machine

Right now I have a Mac Mini. I migrated macbook pro data from a time machine, but I didn't do it from the beginning of my startup. I used the migration assistance to migrate the data. However, I'm getting my macbook pro name in my terminal command line, why is that?

Name-Macbook-Pro:~ name$ 

Why am i getting this? I'm on my Mac Mini, I guess its from the migration but will it affect anything else? How do I change this?


Solution 1:

That part of the prompt is the hostname (\h) by default. Normally changing the computer name from System Preferences also changes the hostname:

The settings are stored in /Library/Preferences/SystemConfiguration/preferences.plist:

<key>Network</key>
<dict>
    <key>HostNames</key>
    <dict>
        <key>LocalHostName</key>
        <string>Lauris-iMac</string>
    </dict>
</dict>
<key>System</key>
<dict>
    <key>ComputerName</key>
    <string>Lauri’s iMac</string>
    <key>ComputerNameEncoding</key>
    <integer>0</integer>
</dict>

This changes the system hostname:

sudo scutil --set HostName My-MacMini

It adds <key>HostName</key><string>My-MacMini</string> under System. If the system hostname has been set, changing the computer name or local hostname from System Preferences won't change the prompt.