DEV Community

Andreas Bergström
Andreas Bergström

Posted on • Edited on • Originally published at andreasbergstrom.dev

Change computer name displayed in Terminal (Mac)

The hostname that shows up in your macOS Terminal prompt is set when you first configured the machine, but you're not stuck with it. scutil is the right tool: scutil --get HostName reads it, scutil --set HostName My-New-HostName writes it. The change is immediate in new shells — no reboot needed in the common case.

The full post walks through opening Terminal, checking the current value, setting a new one, verifying, and the rare case where a reboot is required. Useful if you've inherited a generic Andreas-MacBook-Pro and want something that's actually yours.


Originally published at andreasbergstrom.dev — read the full post there.

Top comments (4)

Collapse
 
deddiekoel profile image
Coert van den Thillart

The actual step that makes the change is missing:

scutil --set HostName My-New-HostName

Collapse
 
andreasbergstrom profile image
Andreas Bergström

Wow, somehow I removed that part... Thanks!

Collapse
 
eliskaholwe profile image
Elis Kaholwe

Okay, so where is step three ?

Collapse
 
andreasbergstrom profile image
Andreas Bergström • Edited

Removed by misstake, should be back now