Sunday, July 26, 2020

"NodeJS cannot be opened" dialog box on MacOS


If you're using MacOS Catalina or newer, using your IDE may get frustrating.  In Spring, every few seconds I'd get a dialog warning me that nodeJS isn't signed and MacOS can't identify if it's malware. This is an easy problem to solve if you can identify the executable because once you do, you use the context menu to "open" it anyhow which tells MacOS that "yeah, the user knows it's not signed but they are confident in this executable."  However the problem in this case is that because this is happening via the IDE, you've no idea in which of the many locations you've got a Node is the binary your IDE is using.  Not an easy problem to solve.

Here's how to solve it

To narrow down your search for which Node binary by paying attention to the date in the warning dialog.

Put MacOS Finder to work:


Refine the search by date and type:


As you adjust the search criteria below, the list of filenames with "node" will adjust in a reactive manner.  I discovered the "Kind" by adding a "Kind" column to the search results which showed "Kind."  This is also the same "Kind" which you see when selecting a file in Finder and examining its "Info." The Kind of "Unix Executable" is synonymous with Terminal Document in this case.

Then give the "node" executable the "context menu->open" treatment:


The above action will open a terminal window and launch Node. What this does is register the app with MacOS that the user has marked the binary as trusted even though it wasn't signed. Once the terminal running Node is launched, you can close terminal (or double ctrl-C), as we've achieved the result we needed—registering it for execution. At this point, try out your IDE and you shouldn't see the dialog box anymore.




No comments:

Post a Comment