<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									macOS - Lazarus Pascal - Determine Processor Brand and Model, and Architecture - Delphi, Lazarus, Free Pascal				            </title>
            <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/macos-lazarus-pascal-determine-processor-brand-and-model-and-architecture/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Tue, 08 Sep 2026 18:03:53 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>macOS - Lazarus Pascal - Determine Processor Brand and Model, and Architecture</title>
                        <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/macos-lazarus-pascal-determine-processor-brand-and-model-and-architecture/#post-4712</link>
                        <pubDate>Fri, 17 Feb 2023 14:18:54 +0000</pubDate>
                        <description><![CDATA[Now that Apple switched to AARCH64 (aka ARM64, Apple Silicon, M1/M2/etc), we sometimes need to determine the processor name and architecture (x86_64, arm64).
Took me some effort to get that...]]></description>
                        <content:encoded><![CDATA[<p>Now that Apple switched to AARCH64 (aka ARM64, Apple Silicon, M1/M2/etc), we sometimes need to determine the processor name and architecture (x86_64, arm64).</p>
<p>Took me some effort to get that, so maybe these 2 functions can be useful for others as well:</p>
<pre contenteditable="false">uses
  ... , Unix, sysctl ...;

...

function GetCPUBrandAndModel: AnsiString;
var
  CharLen : size_t;
  cpuChar : PChar;
begin
  Result :='Unknown CPU';

  if fpSysCtlByName('machdep.cpu.brand_string', Nil, @CharLen, Nil, 0)&lt;&gt;0 then exit;

  cpuChar := GetMem(CharLen);

  try
    if fpSysCtlByName('machdep.cpu.brand_string', cpuChar, @CharLen, Nil, 0)=0 then
      Result := cpuChar;
  finally
    FreeMem(cpuChar);
  end;
end;


function GetCPUArchitecture: AnsiString;
var
  mib     : array of Integer;
  CharLen : size_t;
  cpuArch : PChar;
begin
  mib := CTL_HW;
  mib := HW_MACHINE;

  if fpSysCtl(PCInt(@mib), Length(mib), Nil, @CharLen, Nil, 0)&lt;&gt;0 then exit;

  cpuArch := GetMem(CharLen);

  try
    if fpSysCtl(PCInt(@mib), Length(mib), cpuArch, @CharLen, Nil, 0)=0 then
     Result := cpuArch;
  finally
    FreeMem(cpuArch);
  end;
end;


...

// Example call:
  ShowMessage('CPU Brand and Model: ' + GetCPUBrandAndModel + LineEnding + LineEnding + 'CPU Architecture: ' + GetCPUArchitecture);</pre>
<p> </p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/">Delphi, Lazarus, Free Pascal</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/macos-lazarus-pascal-determine-processor-brand-and-model-and-architecture/#post-4712</guid>
                    </item>
							        </channel>
        </rss>
		