16

At the moment I'm using both uname and sw_vers

darwin_version=`uname -r`
osx_version=`sw_vers -productVersion`

But if I want to display the commercial name (Lion, Mountain Lion, Mavericks, ...) I have to manually maintain a list of osx version - commercial name pair.

I'd like to avoid that manual mapping and rely on system data. Is it possible ?

4
  • When I see commands like system_profiler SPSoftwareDataType I'm not sure it's really possible. Oct 30, 2013 at 11:57
  • Yeah I've looked at system_profiler as well, and that got me desperate, that's why I'm asking here. But I fear too it's not possible.
    – bric3
    Oct 30, 2013 at 12:19
  • I'm not sure which way round to close these as duplicates. This was asked well before the newer question, but it looks like the newer one has got all the attention (except from me, I upvoted and am the save on this question, and never saw the new one!). Or should I merge the newer one into this?
    – grg
    Dec 19, 2022 at 11:42
  • Let's keep this one closed the newer question has more answer to this problem.
    – bric3
    Dec 19, 2022 at 15:16

1 Answer 1

1

Well as you said it : it's a commercial name and it's barely present in the OS it self. It no real wonder, it has no meaning for devs (far less than a version or a build number).

AFAIK It's mentioned in some help pages, but that's almost all.

So until someone would prove me wrong, there is no CLI for that (excluding curl stuff, which would imho not be a suitable option here).

2
  • 1
    Yes that's what I fear! For the eycandy of my script I'd like to display the commercial name, I'm a bit sad there's isn't a property somewhere for that ;)
    – bric3
    Nov 3, 2013 at 10:01
  • When I see the count of upvotes for your question (mine is included) you're not the only one ;) Nov 6, 2013 at 10:24

Not the answer you're looking for? Browse other questions tagged .