Linux에서 익숙한 dmidecode를 macOS에서 그대로 찾으면 막히기 쉽다. dmidecode는 SMBIOS/DMI table을 읽는 Linux 환경의 대표 도구이고, macOS의 기본 hardware inventory 경로는 다르다. Mac에서는 먼저 System Information과 system_profiler를 사용하고, kernel-exposed 값은 sysctl, I/O Registry가 필요할 때만 ioreg로 내려가는 편이 안전하다.
가장 먼저 쓸 명령: system_profiler
hardware overview는 다음 command로 확인할 수 있다.
system_profiler SPHardwareDataType
model name·identifier, chip 또는 processor, core 수, memory, firmware 정보가 나온다. 다만 serial number와 hardware UUID도 포함될 수 있다. terminal output을 issue, chat, blog에 그대로 붙이지 말고 민감 식별자를 지운다.
필요한 data type만 요청하면 전체 report보다 빠르고 결과 범위가 명확하다.
system_profiler -listDataTypes
system_profiler SPHardwareDataType
system_profiler SPDisplaysDataType
system_profiler SPStorageDataType
system_profiler SPNetworkDataType
script에서 구조화된 결과가 필요하면 JSON을 사용할 수 있다.
system_profiler -json SPHardwareDataType > hardware.json
hardware.json도 serial·UUID가 들어갈 수 있으므로 권한과 보관 위치를 확인하고, 공유 전 field allowlist로 새 파일을 만드는 것이 좋다. 전체 report는 network address, installed software 등 예상보다 넓은 inventory를 담을 수 있다.
GUI에서는 System Information
Apple menu의 About This Mac에서 기본 정보를 볼 수 있고, 더 자세한 내용은 System Settings → General → About → System Report로 들어간다. Option key를 누른 채 Apple menu에서 System Information을 여는 방법도 있다.
support 요청에 report를 전달할 때도 필요한 section만 공유한다. serial number는 warranty 조회와 device 식별에 쓰이는 값이므로 공개 게시물에서는 숨긴다.
sysctl: 필요한 Kernel 값만 한 줄로 읽기
sysctl -a | grep ...는 결과가 많고 version·architecture에 따라 key가 달라질 수 있다. 먼저 목적이 명확한 key를 -n으로 읽는다.
sysctl -n hw.model
sysctl -n hw.memsize
sysctl -n hw.ncpu
sysctl -n hw.physicalcpu
sysctl -n hw.logicalcpu
hw.model: hardware model identifierhw.memsize: byte 단위 physical memoryhw.ncpu: 현재 사용 가능한 CPU 수와 관련된 값hw.physicalcpu,hw.logicalcpu: physical·logical CPU count
key 존재 여부와 의미는 macOS version과 Intel·Apple silicon에서 달라질 수 있다. machdep.cpu.brand_string 같은 Intel 중심 key 하나에 의존하지 말고, model·chip display는 system_profiler 결과와 함께 확인한다.
memory byte를 GiB로 바꾸려면 shell integer division보다 Python으로 단위를 명시할 수 있다.
python3 - <<'PY'
import subprocess
size = int(subprocess.check_output(["sysctl", "-n", "hw.memsize"], text=True))
print(f"{size / 1024**3:.1f} GiB")
PY
GB와 GiB는 기준이 다르다. vendor storage 표기는 decimal GB를, OS tool은 binary 단위를 쓰는 경우가 있어 숫자만 비교하지 않는다.
uname과 sw_vers가 알려 주는 범위
uname -m
uname -r
sw_vers
uname -m은arm64,x86_64같은 machine architecture를 보여 준다. Mac의 marketing model name이 아니다.uname -r은 Darwin kernel release다. macOS product version과 같지 않다.sw_vers는 macOS product name·version·build를 보여 준다.
Rosetta로 실행한 process의 architecture와 host hardware architecture를 구분해야 할 때는 현재 process가 무엇으로 실행됐는지도 함께 확인한다.
ioreg는 Device Tree가 필요할 때만
ioreg는 I/O Registry tree를 조회하는 낮은 수준의 도구다.
ioreg -p IODeviceTree -l
ioreg -r -c IOPlatformExpertDevice -d 1
출력이 크고 property 이름은 stable public API처럼 가정하기 어렵다. 또한 IOPlatformSerialNumber와 platform UUID 같은 식별자가 보일 수 있다. hardware inventory를 얻기 위해 무조건 ioreg -l | grep ...부터 쓰기보다 system_profiler나 공식 framework로 해결할 수 있는지 먼저 본다.
Apple도 Terminal에서 serial을 확인하는 예로 ioreg -l | grep IOPlatformSerialNumber를 안내하지만, 확인 가능한 것과 공개해도 되는 것은 다르다. blog·CI log·support ticket의 audience를 따로 판단한다.
목적별 추천 순서
| 목적 | 첫 도구 | 다음 확인 |
|---|---|---|
| model·chip·memory overview | system_profiler SPHardwareDataType |
About This Mac / System Information |
| CPU·memory 값을 script로 읽기 | sysctl -n <key> |
OS·architecture별 key 존재 확인 |
| macOS version·build | sw_vers |
uname -r은 kernel release로 분리 |
| display·storage·network inventory | 필요한 system_profiler data type |
민감 field redaction |
| device tree·driver property | 좁힌 ioreg plane·class |
property stability와 권한 확인 |
CPU와 memory 용어 자체가 필요하면 CPU와 Memory 기본 개념, memory pressure를 실제로 읽는 방법은 macOS에서 free 대신 memory 확인하기로 이어갈 수 있다.
자주 묻는 질문
macOS에 dmidecode를 설치하면 같은 결과를 얻나
Linux에서 SMBIOS/DMI를 읽는 workflow를 그대로 옮기는 것은 적절하지 않다. macOS가 제공하는 System Information, system_profiler, sysctl, I/O Registry를 목적에 맞게 사용한다.
system_profiler 전체 결과를 공유해도 되나
권장하지 않는다. serial number, UUID, network 정보, 설치 항목이 포함될 수 있다. 필요한 data type과 field만 남겨 공유한다.
Apple silicon에서도 machdep.cpu를 쓰면 되나
key set이 Intel Mac과 같다고 가정하지 않는다. system_profiler SPHardwareDataType을 기준으로 보고, script에서는 필요한 hw.* key가 실제 host에 있는지 확인한다.
참고 자료
'배움과 성장 > 시스템·성능' 카테고리의 다른 글
| Meltdown·Spectre 차이: transient execution과 CPU 완화책 (0) | 2024.09.19 |
|---|---|
| Hyper-Threading과 SMT: 논리 CPU·공유 자원·성능 측정 (1) | 2024.09.19 |
| 스풀링이란: 이메일 큐와 인쇄 큐가 작업을 버퍼링하는 방식 (4) | 2024.08.15 |
| 운영체제 핵심 기능 학습노트: CPU Scheduling·Virtual Memory·Storage (0) | 2023.03.26 |
| 운영체제란 무엇인가: 자원 관리·추상화·보호의 세 역할 (0) | 2023.03.26 |
댓글