Does anyone know how to retrieve the BIOS information on a Mac? I think the manufacture is Apple but how do I get the version number and maybe the date? Thanks.
In a shell you could get this:
me@Mac-Studio ~ % system_profiler SPSoftwareDataType SPHardwareDataType
Software:
System Software Overview:
System Version: macOS 14.6.1 (23G93)
Kernel Version: Darwin 23.6.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: Mac Studio
User Name: Just Me (me)
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 5 Stunden und 20 Minuten
Hardware:
Hardware Overview:
Model Name: Mac Studio
Model Identifier: Mac13,1
Model Number: Z14J000JZSM/A
Chip: Apple M1 Max
Total Number of Cores: 10 (8 performance and 2 efficiency)
Memory: 64 GB
System Firmware Version: 10151.140.19
OS Loader Version: 10151.140.19
Serial Number (system): XXXXXXXXXXXXX
Hardware UUID: XXXXXX-XXXX-XXXX-XXXX-XXXXXXX
Provisioning UDID: XXXXXXXXX-XXXXXXXXXXXXX
Activation Lock Status: Enabled
You could get much more information:
I’m looking for information just like this, but I want to retrieve it using code so I can work with it in an app.
You already have the information.
Search on the documentation how to deal with the Terminal from Xojo.
In the Terminal, type:
man system_profiler
and you will get the list of availlable commands.
You want a more precise anser ? Here you are: Using the Shell
Look at the example that get an answer back from the Shell call.
You could run the shell command in the Window opening event and store everything in a dictionary. That way you have all information at your hand when you need them instead of calling the shell every time you need it.
In the completed event of your shell just do something like:
If Me.ExitCode = 0 Then
Var s() As String = Me.ReadAll.Split(EndOfLine)
Var info As New Dictionary
For Each line as String in s
Var p() As String = line.TrimLeft.Split(": ")
If p.Count = 2 Then
info.Value(p(0)) = p(1)
End If
Next
// Here comes the dictionary lookup
TextArea1.AddText("Computer Model: " + info.Lookup("Model Name", "") + EndOfLine)
End If