Check for Mac still valid?

I’m tasked with maintaining a plugin with some old code. Some mysterious problems for mac has popped up.

For very new OSX, is the following check still valid?

( Object::RUBY_PLATFORM =~ /darwin/i ? true : false )

(And yes, the code above will be changed but I need to narrow down the problems for the errors we’re seeing)

Since 2014 there is a preferred method here:


I know and the code will be changed. But I need to trace some very mysterious problems in an already shipped product. The above code could be one possible source unless it returns true on mac (which I think it does)…

I see. I do not have mac to test… :blush:

is the name of the kernel that Mac OS X / macOS uses. Apple hasn’t swapped the kernel, and I would assume there would be some outrage on Ruby sites if the Ruby platform name had changed.

If you suspect an installed plugin runs the wrong platform’s code branches, you can test several OS detection methods (the one dezmo posted) and see whether they give inconsistent results.

Returns true on Mac.

Does this mean that SketchUp have given you a Mac for testing? Can you now make Open Newer Version for Mac?

I see ‘true’ on my Big Sur MacBook Pro (Intel), and on an Apple Silicon Mac mini.

Got a Macbook with bootcamp as work computer :smiley: . Haven’t had the time to look over my own extensions on Mac yet though.

That expression still works as of Catalina (I haven’t moved to BigSur yet because I am addicted to the Space Navigator and don’t want to rely on the beta driver before it is released). Long term it is at risk, though, because the ‘darwin’ embedded in it is from the underlying build of the BSD kernel from which OS X was derived. Apple has hinted that some day they may start over with the kernel, at which point darwin may drop out.

Thanks for the answers! I now think I know what the error is, but I know nothing about Macs so I throw out the question here (It’s not directly related to Sketchup).

The error in question seems to be that the activation with a 3:rd party licensing software fails due to the user not having the right privileges. Is there a mac equivalent of “run as administrator”?

mac uses the standard UNIX sudo command to “switch user”. This temporarily elevates privileges. You can read about its use and arguments in its man page.

Edit: if that was all jargon to you, you should enlist the help of a UNIX or macOS guru.

That seems like the way to go at present.

I can tell you how to get out of Bootcamp, if you find that to be somewhat hidden!

1 Like

I’ve managed, and also compiled SU om Mac :smiley: , but I agree it was not very obvious. I don’t know why I’m not asked for what OS ton use on each startup, with a customizable timeout before the default option is selected.

You can restart with Option held down, as a way to do that. The hidden control panel may be because it’s a run as admin task. I’m guessing though.

It would be cool to have testing environments (e.g. VM or docker image or remote desktop in the cloud, which is both unfortunately not a natural thing with proprietary OS) accessible to developers, who after all provide software for either platform. Only commercial developers have an incentive to invest into owning every possible system/hardware.

Or have an extension API in SketchUp for Web, where all such extensions are guaranteed to behave exactly the same way over the whole SketchUp platform (web, desktop, mobile). Yes, it’s less an issue with pure SketchUp API extensions than rather with any further system integration (binaries, file system access, calling other apps/processes), but web APIs are moving there and hiding OS differences behind a perfectly cross-platform API.


If there is concern about RUBY_PLATFORM, RbConfig::CONFIG["CC_VERSION_MESSAGE"] is a few lines long, first line is
Apple clang version 11.0.3 (clang-1103.0.32.62)