Sub topic 14
Checking versions and displays from Terminal
This chapter assumes you can open Terminal and run a command, and that you know the OS requirements from the earlier chapters. Those are macOS Catalina 10.15 or later for Sidecar, and macOS Monterey 12.3 or later with iPadOS 15.4 or later for Universal Control. You will use two built-in commands to check the Mac side of the setup without opening System Settings. These checks are quick, scriptable, and easy to paste into a support request.
What Terminal can and cannot tell you
Terminal runs on the Mac, so it only reports Mac facts. It can tell you the following:
- Which macOS version and build the Mac runs.
- Which displays macOS currently sees, including whether an iPad connected through Sidecar is among them.
- Which Mac model and chip you have, which you can compare with Apple's compatibility list.
It cannot read the iPad's iPadOS version, Wi-Fi state, or Handoff setting. Check those on the iPad under Settings > General > About. It also cannot tell you whether Universal Control is switched on, because that feature does not create a display.
| Question | Where to answer it |
|---|---|
| Is the Mac's macOS new enough? | Terminal, `sw_vers` |
| Is the iPad's iPadOS new enough? | iPad, Settings > General > About |
| Is the iPad acting as a Sidecar display? | Terminal, `system_profiler SPDisplaysDataType` |
| Is Universal Control enabled? | Mac System Settings > Displays > Advanced |
| Is the Mac model supported? | Terminal, `system_profiler SPHardwareDataType`, then Apple's support page |
Reading the macOS version with sw_vers
sw_vers prints the product name, version, and build of the running system.
sw_versThe output has three lines. The values below are an example, and yours will differ.
ProductName: macOS
ProductVersion: 15.1
BuildVersion: 24B83ProductNameis the operating system name. Very old releases report "Mac OS X".ProductVersionis the number to compare with the requirements. Compare it as a version, not as a decimal. 12.3 is newer than 12.10 only if you read it as a decimal, and as a version it is older.BuildVersionidentifies the exact build. It matters when you report a bug or compare two Macs on the same version number, for example a beta against a release.
Each field has its own flag, which is useful in scripts:
sw_vers -productVersion
sw_vers -buildVersionEach command prints a single value with no label, so you can store it in a variable.
Comparing the version with the requirements in a script
Shell comparison operators such as -ge only handle whole numbers, so they fail on "12.3". The sort -V option sorts by version number instead. The following script reports whether the Mac meets each minimum. It runs as shown on macOS.
#!/bin/bash
# Report whether this Mac's macOS meets the minimum for each feature.
current=$(sw_vers -productVersion)
meets_minimum() {
# Succeeds when $1 (minimum) sorts at or before $2 (current).
lowest=$(printf '%s\n%s\n' "$1" "$2" | sort -V | head -n 1)
[ "$lowest" = "$1" ]
}
echo "macOS version: $current"
if meets_minimum "10.15" "$current"; then
echo "Sidecar: macOS version is new enough"
else
echo "Sidecar: macOS version is too old"
fi
if meets_minimum "12.3" "$current"; then
echo "Universal Control: macOS version is new enough"
else
echo "Universal Control: macOS version is too old"
fiSave it as check-os.sh, then run bash check-os.sh.
The script checks only the OS version. A Mac can run a new macOS and still lack hardware support, and the iPad has its own requirements. Treat "new enough" as one necessary condition, not proof that the feature will work.
Checking the Mac model
The model also determines support. This command lists hardware details:
system_profiler SPHardwareDataTypeLook at the Model Name, Model Identifier, and Chip (or Processor Name on Intel Macs) lines. Compare the model name and year with the compatibility list on Apple's support page. This command is not part of the chapter's two main checks, but it completes the picture from the Mac side.
Listing displays with system_profiler
system_profiler reports detailed system information, and SPDisplaysDataType limits the output to graphics hardware and attached displays.
system_profiler SPDisplaysDataTypeThe output is grouped by graphics processor, with a Displays: section under it. A Mac with its built-in screen and a connected iPad might look like this. The exact lines vary by Mac, macOS version, and iPad.
Graphics/Displays:
Apple M2:
Chipset Model: Apple M2
Type: GPU
Bus: Built-In
Total Number of Cores: 10
Vendor: Apple (0x106b)
Metal Support: Metal 3
Displays:
Color LCD:
Display Type: Built-In Liquid Retina XDR Display
Resolution: 3024 x 1964 Retina
Main Display: Yes
Mirror: Off
Online: Yes
Sidecar Display (AirPlay):
Resolution: 2360 x 1640
Mirror: Off
Online: YesThe lines to read are these:
- Each named block under
Displays:is one display. A Sidecar session adds an extra block, often named with "Sidecar" in it. The exact name can differ between macOS versions. Resolutionis the pixel size macOS uses for that display. A new block with an iPad-like resolution is a good sign that Sidecar is active.Main Display: Yesmarks the display that holds the menu bar's primary role. The iPad normally does not take this role.Mirror: Onmeans the display shows the same content as another one.Mirror: Offmeans the iPad extends the desktop. This matches the extended and mirrored modes you set in Displays settings.Online: Yesmeans macOS currently treats the display as connected.
Confirming a Sidecar session
Run the command twice and compare. This sequence uses only commands covered above:
- Run
system_profiler SPDisplaysDataTypebefore connecting and note the display blocks. - Connect the iPad through Sidecar, as described in the earlier chapters.
- Run the command again. A new display block means macOS sees the iPad as a display.
- Disconnect the iPad and run it a third time to confirm the block is gone.
If you only want the headline facts, filter the output:
system_profiler SPDisplaysDataType | grep -E "Resolution|Mirror|Online|Sidecar"To count the displays macOS reports, count the resolution lines:
system_profiler SPDisplaysDataType | grep -c "Resolution:"Compare this number before and after connecting the iPad. It should go up by one when Sidecar starts. It is a rough check. A Mac with several graphics processors or a closed lid can show unexpected counts, so read the full output when the number surprises you.
Machine-readable output
For scripts, -json gives structured output that is easier to parse than plain text:
system_profiler SPDisplaysDataType -jsonThe display entries sit under a key such as spdisplays_ndrvs. Treat the key names as an implementation detail, because Apple does not guarantee them across macOS versions. Parse defensively and handle missing keys.
Why Universal Control does not appear
A Universal Control session does not add a display. Each device keeps its own screen, and the Mac's pointer and keyboard are passed across the edge between them. So system_profiler SPDisplaysDataType shows the same displays whether Universal Control is working or not. Do not use it as a Universal Control test.
To test Universal Control, use the checks in the troubleshooting chapter. Those include the settings in System Settings > Displays > Advanced, the shared sign-in, and moving the pointer past the screen edge. From Terminal you can only rule out one cause, an outdated macOS, with sw_vers.
A checking workflow
Common mistakes
- Comparing versions as decimals. "12.10" would look smaller than "12.3" as a number. Use
sort -Vor compare each part separately. - Treating a passing OS check as full compatibility. The Mac model and the iPad matter as well.
- Expecting Universal Control in the display list. It never appears there.
- Reading a stale result. The output shows the state when you ran the command. Run it again after you change anything.
- Relying on the display name. A name containing "Sidecar" is typical but not guaranteed. A new block with an iPad-sized resolution is the stronger signal.
Exercise
You run system_profiler SPDisplaysDataType while your iPad is connected by Sidecar and see only the built-in display. Separately, Universal Control works fine between the same two devices. Is this contradictory, and what should you check next?
Show answer
It is not contradictory. Universal Control does not create a display, so it never appears in the display list. The missing block does mean the Sidecar session is not active, so run sw_vers to confirm macOS is at least 10.15, then check the iPad's iPadOS version, the shared Apple Account sign-in, Wi-Fi, Bluetooth, and Handoff, and start the Sidecar connection again.
Exercise
A script compares the output of sw_vers -productVersion with "12.3" using the shell operator -ge, and it fails with an error. Why, and how do you fix it?
Show answer
The -ge operator only compares whole integers, and a value such as 12.3 is not an integer. Compare versions with sort -V, as in the meets_minimum function, which prints the lower of the two versions and checks whether it equals the required minimum.