github.com/haraldrudell/parl@v0.4.176/punix/processor-darwin.go (about) 1 //go:build darwin 2 3 /* 4 © 2023–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/) 5 ISC License 6 */ 7 8 package punix 9 10 import ( 11 "github.com/haraldrudell/parl/perrors" 12 "golang.org/x/sys/unix" 13 ) 14 15 const ( 16 machdepCpuBrandString = "machdep.cpu.brand_string" 17 ) 18 19 // Processor returns human readable string like "Apple M1 Max" 20 func Processor() (model string, err error) { 21 if model, err = unix.Sysctl(machdepCpuBrandString); perrors.Is(&err, "sysctl %s %w", machdepCpuBrandString, err) { 22 return 23 } 24 return 25 }