How to get Mac Computer Name using Terminal

If you want to know the Computer Name of your Mac (Macbook/iMac/Mac Studio) you can make use of the scutil - the interactive access to the dynamic store for macOS.

scutil --get ComputerName

Code2care's MacBook Pro

As you can see, we made use of the --get option followed by ComputerName.

Get Computer Name using Mac Terminal


If you want to change the name of your Mac using Terminal, you can make use of the --set option along with scutil.

scutil --set ComputerName "Alan's Macbook Pro"

Note: You will be prompted to provide the password or Touch ID to apply the new name.

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!