If you need to contact Apple Support, check your warranty status, or prepare your computer for a trade-in, you will need your Mac’s serial number. Most users find this by clicking the Apple logo and selecting “About This Mac.” But what if your Mac’s graphical interface is frozen, the screen is damaged, or you are managing the computer remotely via SSH?
In these situations, you can quickly retrieve the serial number using the macOS Terminal.
Using the system_profiler Command
The macOS Terminal contains a powerful diagnostic tool called system_profiler, which can generate highly detailed reports about your Mac’s hardware and software configuration. By filtering its output, you can extract just your serial number.
- Open the Terminal app (you can find it in Applications > Utilities, or by searching for it via Spotlight).
- Type the following command exactly as written:
system_profiler SPHardwareDataType | grep "Serial Number" - Press Return.
The Terminal will output a single line of text that looks like this: Serial Number (system): C02XXXXXXXXX.
The alphanumeric string at the end of that line is your Mac’s unique serial number.
Using the ioreg Command
If the system_profiler command fails or is taking too long to run (as it sometimes queries the entire hardware tree before filtering), you can use a faster, more direct command that queries the I/O Kit registry directly.
Type the following command into the Terminal:ioreg -l | grep IOPlatformSerialNumber
The output will display your serial number inside quotation marks at the end of the line. Both methods are completely safe and do not make any changes to your system configuration.