From 5c24bd443a2e3e9419012ec7f4e6568dc48e9ccf Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Sat, 15 Feb 2025 09:03:48 -0500 Subject: [PATCH] [PR] fix cpu fetching code for leopard and tiger (#387) * fix cpu fetching code for leopard and tiger * some 10.5 systems have this sysctl, just check if it exists like this --- neofetch | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/neofetch b/neofetch index 69dd871e..f1f30e7f 100755 --- a/neofetch +++ b/neofetch @@ -3175,19 +3175,10 @@ END ;; "Mac OS X"|"macOS") - if [[ $osx_version == 10.[4-5]* ]]; then - cpu="$(system_profiler SPHardwareDataType | grep CPU\ Type)" - cpu="${cpu/CPU\ Type\:/}" - - speed="$(system_profiler SPHardwareDataType | grep CPU\ Speed)" - speed="${speed/CPU\ Speed\:/}" - speed="${speed/ MHz/}" - speed="${speed/ GHz/}" - - cores="$(system_profiler SPHardwareDataType | grep Number\ Of\ CPUs)" - cores="${cores/Number\ Of\ CPUs\:/}" - else - cpu="$(sysctl -n machdep.cpu.brand_string)" + cpu="$(sysctl -n machdep.cpu.brand_string 2>/dev/null)" + if [ -z "$cpu" ]; then + cpu="$(system_profiler SPHardwareDataType | grep Processor\ Name)" + cpu="${cpu/Processor\ Name\:/}" fi # Get CPU cores. @@ -3374,7 +3365,6 @@ END cpu="${cpu//[1-9][0-9]-Core}" cpu="${cpu//[0-9]-Core}" cpu="${cpu//, * Compute Cores}" - cpu="${cpu//Core / }" cpu="${cpu//(\"AuthenticAMD\"*)}" cpu="${cpu//with Radeon*Graphics}" cpu="${cpu//, altivec supported}"