How can I know the macOS version (such as 10.12.1) installed on the startup drive if I don't have the password (or has filevault encryption and I don't have the password). I wonder if there's a way to know it by using a Terminal command from macOS recovery or by starting from an External storage disk.
-
Full disk encryption being enabled and you not knowing the password is quite a game changer for your question, and it’s easy to overlook when it’s not explicitly in the title. To get more helpful answers, you may want to include that fact in the title of your post.– SynoliCommented Apr 19, 2018 at 4:51
3 Answers
The ProductVersion is stored within the SystemVersion.plist file in CoreServices. This can be read using defaults:
defaults read /System/Library/CoreServices/SystemVersion ProductVersion
When you're accessing the startup disk from another volume, you'll need to provide the full path to both defaults and /System:
/Volumes/Macintosh\ HD/usr/bin/defaults read /Volumes/Macintosh\ HD/usr/bin/System/Library/CoreServices/SystemVersion ProductVersion
-
You can get a little more info (mostly the build number) by leaving off "ProductVersion". Commented Apr 18, 2018 at 22:18
You can use sw_vers
Internal Drive:
➜ ~ sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.4
BuildVersion: 17***
External Drive:
You can simply consult the files that sw_vers
use
➜ ~ man sw_vers
[...]
FILES
/System/Library/CoreServices/SystemVersion.plist
/System/Library/CoreServices/ServerVersion.plist
So in order to access to theses files on your external volume, you can simply do:
✗ cat /Volumes/YOUR_VOLUME_NAME/System/Library/CoreServices/SystemVersion.plist
-
Is it possible to pass in a separate volume into sw_vers, otherwise this'll read the host rather than the external hard drive volume?– grg ♦Commented Apr 18, 2018 at 20:27
-
-
sorry mate, what do I type in Terminal then? Startup volume is Macintosh HD and it's a typical default install on a macbook pro.. Commented Apr 19, 2018 at 5:12
-
you can also simply have a look at the file /System/Library/CoreServices/SystemVersion.plist
(which is the same as what the default
command in the other answers does)... it's simple plist file in XML.