Verify applications

To verify applications in Terminal is not an issue, but how can I get same results in Applescript?

set appSig to (do shell script "codesign -dv /Applications/")

Since Big Sur, the Mac has 2 partitions of the boot drive that are merged at runtime.
This is for security reasons. The “System” part contains all the OS and OS included applications.
There the “” is really in location “/System/Applications/”
User installed apps are in “/Applications/”.

so the AppleScript is

set appSig to do shell script "codesign -dv /System/Applications/ 2>&1"

had to set stderr to stdout to get the results

Maybe, your application doesn’t open due to other reason as well. Try to remove gatekeeper quarantine as additional step. This step is useful for applications from unknown (to Apple) developers. Example I use for my Mac:

set theApp to ((path to applications folder) as text) & ""
set appPosixPath to POSIX path of theApp
set quotedPath to quoted form of appPosixPath
do shell script "xattr -rd " & quotedPath with administrator privileges

Thanks to both for your awesome suggestions,

My problem is, i get an empty string in “Script Editor” like this:

Tell current application
do shell script "codesign -dv /Applications/"
--> ""

Meanwhile i get a normal and complete output in “Terminal”
It doesn’t matter what app i check with “Script Editor”, results are always empty and results in Terminal are always complete


It seems you didn’t read any of my previous post which explains this.

For Big Sur or newer…

do shell script "codesign -dv /System/Applications/ 2>&1"

or on older OSes

do shell script "codesign -dv /Applications/ 2>&1"

or you could just use regular AppleScript

POSIX path of (path to application "Books")

so the full script line would be (for all OS versions)

do shell script "codesign -dv " & (POSIX path of (path to application "Books")) & " 2>&1"

Yes, quite strange indeed. I confirm that all your scripts on this topic gives me the desired result. It’s weird to think that they only works for the two of us.

Regarding the Posix path of app: it can be retrieved without application launching as well. Also, quoted form is preferable:

on codeSignInfoFor:appName
	set bundleID to id of application appName
	tell application "Finder" to set appHFSpath to application file id bundleID as Unicode text
	set appQuotedPosixPath to quoted form of POSIX path of appHFSpath
	do shell script "codesign -dv " & appQuotedPosixPath & " 2>&1"
end codeSignInfoFor:

my codeSignInfoFor:"Safari"

Thanks KniazidisR,

Here is a slightly different version that uses ‘System Events’ instead of ‘Finder’

EDIT having problems , found bug

	tell application "System Events" to set myApp to application "Books"
	set appQuotedPosixPath to quoted form of POSIX path of (path to myApp)
	do shell script "codesign -dv " & appQuotedPosixPath & " 2>&1"

Only problem with ‘System Evemts’ is you have to hard code the app name. You can’t use a variable or it will error out.

EDIT - crap, it still is launching the app. DAM, I tried

But the App still launches


Ops, i skimmed your post and didn’t notice you redirected the output to stdout.
Now it’s working :slight_smile:
Thanks again to everyone