UXP to determine if machine is M1 and running Rosetta?

Is there a way in Photoshop UXP to determine if the machine is a Mac M1 machine? If so, is there a way to determine if it is running Rosetta or Native?

1 Like

I couldn’t find an API for that. In some environments there is a platform.device string.

Have you tried checking the platform?

const platform = require("os").platform();

For OSX it should say darwin
and for Windows it should say win10

If you have access to an M1 it might say something else?

Or you might be able to check the window.navigator.userAgent property.

Actually, userAgent returns, "Adobe UXP Runtime"

const platform = require("os").platform(); returns as darwin for M1, same as all other Mac.

require("os").arch() is coming in a future release. That will indicate x64 or arm64 based upon the architecture. If emulated, though, it still shows as Intel.

Is there a particular reason you’re looking for this value? UXP plugins themselves should work as-is on either platform. Maybe analytics?

2 Likes

A couple of my plugins need the “Select>Subject” selection to be accurate. On M1 in Rosetta the Select Subject is all over the place with it’s selections. On M1 Native the Select Subject works fine. I want to disable those plugins from running on M1 in Rosetta.

Here is a sample image for what I am referring to with the Select Subject not working right in Rosetta mode. I just posted a bug reports on the main Photoshop feedback forum. Since this is a general issue and not related to development, I think this is where I am suppose to post a bug???

Is the Select Subject a known issue with Rosetta? If so, do you know if a fix is being worked on?

The situation I am in right now is I have 2 programs still running CEP that I haven’t yet converted to UXP. Users need to run in Rosetta mode for those 2 CEP panels. However, when doing so, the Select Subject issue affects 2 of my other UXP plugins which the same users are using.

My plan is to convert my last 2 CEP panels to UXP but these 2 are very time consuming to convert so that will take months to complete. For now, I am telling users that they have to switch back and forth between running Photoshop in Rosetta when they need to run the CEP panels but switch back to Native when running the other UXP plugins which use Select Subject. The users really don’t like having to switch back and forth, especially when their workflow is continually switching from using 1 plugin to the other.

is there any news? is it possible to determine if the platform is an intel mac or m1?

os.arch() should return "arm64" for AppleSilicon.

1 Like

THANK YOU @DavideBarranca (pd)