macOS升级到Ventura后dmidecode无法使用处理方案

最近将主力工作机macOS升级到了Ventura,发现dmidecode无法使用,特此记录一下如何解决

下载dmidecode-osx源码

1
git clone https://github.com/cavaliercoder/dmidecode-osx

修改代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
diff --git a/dmidecode.c b/dmidecode.c
index bb651da..194108c 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4811,8 +4811,10 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
* This CFRelease throws 'Segmentation fault: 11' since macOS 10.12, if
* the compiled binary is not signed with an Apple developer profile.
*/
+ #ifdef SIGNED_BINARY // So don't do that unless you signed it
if (NULL != properties)
CFRelease(properties);
+ #endif

IOObjectRelease(service);
}
@@ -5147,7 +5149,7 @@ int main(int argc, char * const argv[])
goto exit_free;
}

- CFDataGetBytes(dataRef, CFRangeMake(0, 0x20), (UInt8*)buf);
+ CFDataGetBytes(dataRef, CFRangeMake(0, CFDataGetLength(dataRef)), (UInt8*)buf);

if (NULL != dataRef)
CFRelease(dataRef);

编译&安装

1
make && make install

卸载命令

1
make uninstall

结束

源码出处:https://github.com/cavaliercoder/dmidecode-osx

解决方案出处:https://github.com/cavaliercoder/dmidecode-osx/issues/8

Fiveplus wechat
扫一扫上方二维码,关注微信公众号:阿五编程
如果这篇文章对你有所帮助,请点击下方的打赏按钮。