Saturday, October 1, 2022

#1 2022-09-22 01:43:08 pm

robertfern
Member
Registered: 2011-11-29
Posts: 202

Apple's T2 chip

Is there a way to detect in AppleScript whether the Mac I'm booted from has a T2 security chip?

Offline

 

#2 2022-09-22 02:05:50 pm

Mockman
Member
From:: Toronto
Registered: 2020-05-27
Posts: 239

Re: Apple's T2 chip

Does the System Information application have access to that information? If so, you can likely run the shell command 'system_profiler' and get that information.

do shell script "system_profiler"

I would check the app first and see what section that information is contained within. Then you can restrict system_profiler to that section and then use grep to access the specific line. Details on usage can be found using 'man system_profiler' in the Terminal.

There are some posts here that deal with similar usage, like this one:
https://macscripter.net/viewtopic.php?id=35490

There is an applescript command —system info, in Standard Additions— which can tell you the CPU but I would be surprised if it had access to the information you seek.

Browser: Firefox 107.0
Operating System: macOS 10.12

Offline

 

#3 2022-09-22 03:09:23 pm

estockly
Member
Registered: 2009-01-03
Posts: 132

Re: Apple's T2 chip

robertfern wrote:

Is there a way to detect in AppleScript whether the Mac I'm booted from has a T2 security chip?



use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

set sysInfo to system info
CPU type of sysInfo
-->>Intel x86-64h Haswell



Does that help?

Offline

 

#4 2022-09-22 04:21:48 pm

robertfern
Member
Registered: 2011-11-29
Posts: 202

Re: Apple's T2 chip

Here is what I cobbled together

Applescript:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

set myAns to do shell script "system_profiler SPiBridgeDataType"
if myAns contains "T2 Security" then
   -- do stuff here that requires T2 Security Chip
end if

Offline

 

#5 2022-09-22 07:50:14 pm

Mockman
Member
From:: Toronto
Registered: 2020-05-27
Posts: 239

Re: Apple's T2 chip

Looks good. My system doesn't generate any data when using the 'SPiBridgeDataType' data type —it's old.

If what you need is 'basic', then you could likely possibly speed up the command by using the '-detaillevel option. Also, you could add a grep to your shell command and collect select information.

For example:

This searches for any connected USB devices and returns what they are (by grabbing the two lines above each search hit.

Applescript:

use scripting additions
do shell script "system_profiler SPUSBDataType | grep -B 2 'Product\\ ID'"
(*
" Card Reader:

Product ID: 0x8406
--
Apple Internal Keyboard / Trackpad:

Product ID: 0x0262
--
BRCM20702 Hub:

Product ID: 0x4500
--
Bluetooth USB Host Controller:

Product ID: 0x8289"
*)

This generates a list of applications, looks for Script Debugger amongst them and if present, returns the version number.

Applescript:

set verNum to last word of (do shell script "system_profiler -detaillevel basic SPApplicationsDataType | grep -F -A 2 'Script Debugger' | grep 'Version:'")

Offline

 

#6 2022-09-25 03:04:19 pm

Fredrik71
Member
Registered: 2019-10-23
Posts: 973

Re: Apple's T2 chip

Or you could get from this website: https://support.apple.com/en-us/HT208862
the Model Identifier:.... And then ask the list if it contains the model identifier...

The security feature or enhanced security in Apple Silicon is also faster. So you will not find that
string in Apple Silicon machine from system_profiler. In other words T2 is intel CPU Mac feature.

Last edited by Fredrik71 (2022-09-25 03:04:48 pm)


Node-RED makes it easy to automate IoT

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)