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
As you can see, we made use of the --get option followed by ComputerName.

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"
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!