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.


Facing issues? Have Questions? Post them here! I am happy to answer!

Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap