原因是主程序对 libonigwrap.dylib 的引用是 裸库名(没有路径前缀) 解决方法在最后
第一次启动报错详细日志如下
Translated Report (Full Report Below)
Process: Steam++ [10104]
Path: /Applications/Steam++.app/Contents/MacOS/Steam++
Identifier: net.steampp.app
Version: 3.1.0 (3.1.2021.0)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2026-06-25 08:18:29.5568 +0800
OS Version: macOS 12.7.6 (21H1320)
Report Version: 12
Anonymous UUID: CD5EDFC1-1B66-4689-C409-736D2CE355EB
Sleep/Wake UUID: CA4B18C6-FB05-4FE3-9A16-0572A2D25A00
Time Awake Since Boot: 4200000 seconds
Time Since Wake: 435473 seconds
System Integrity Protection: enabled
Crashed Thread: 0
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace DYLD, Code 1 Library missing
Library not loaded: 'libonigwrap.dylib'
Referenced from: '/Applications/Steam++.app/Contents/MacOS/Steam++'
Reason: tried: 'libonigwrap.dylib' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file)
(terminated at launch; ignore backtrace)
Thread 0 Crashed:
0 dyld 0x11b8729a2 __abort_with_payload + 10
1 dyld 0x11b888ab2 abort_with_payload_wrapper_internal + 80
2 dyld 0x11b888ae4 abort_with_payload + 9
3 dyld 0x11b836699 dyld4::halt(char const*) + 615
4 dyld 0x11b8325b5 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3995
5 dyld 0x11b8314e4 start + 388
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000002000209 rbx: 0x0000000000000000 rcx: 0x00007ff7b05f4588 rdx: 0x00007ff7b05f49f0
rdi: 0x0000000000000006 rsi: 0x0000000000000001 rbp: 0x00007ff7b05f45d0 rsp: 0x00007ff7b05f4588
r8: 0x00007ff7b05f45f0 r9: 0x0000000000000000 r10: 0x0000000000000057 r11: 0x0000000000000246
r12: 0x0000000000000057 r13: 0x00007ff7b05f49f0 r14: 0x0000000000000001 r15: 0x0000000000000006
rip: 0x000000011b8729a2 rfl: 0x0000000000000246 cr2: 0x0000000000000000
Logical CPU: 0
Error Code: 0x02000209
Trap Number: 133
Binary Images:
0x11b82c000 - 0x11b897fff dyld (*) /usr/lib/dyld
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=23.1M resident=0K(0%) swapped_out_or_unallocated=23.1M(100%)
Writable regions: Total=9.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9.9M(100%)
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
STACK GUARD 56.0M 1
Stack 8192K 1
VM_ALLOCATE 12K 3
__DATA 1684K 24
__DATA_CONST 416K 15
__LINKEDIT 6816K 19
__TEXT 16.5M 17
dyld private memory 1024K 1
=========== ======= =======
TOTAL 90.2M 81
Full Report
{"app_name":"Steam++","timestamp":"2026-06-25 08:18:29.00 +0800","app_version":"3.1.0","slice_uuid":"5daf5fae-0f5a-3d7f-b452-498846fbc4f0","build_version":"3.1.2021.0","platform":1,"bundleID":"net.steampp.app","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.7.6 (21H1320)","incident_id":"58FD5532-D53B-4081-814E-333640477C16","name":"Steam++"}
{
"uptime" : 4200000,
"procLaunch" : "2026-06-25 08:18:29.5416 +0800",
"procRole" : "Default",
"version" : 2,
"userID" : 501,
"deployVersion" : 210,
"modelCode" : "MacBookPro11,4",
"procStartAbsTime" : 4235656712998950,
"coalitionID" : 391853,
"osVersion" : {
"train" : "macOS 12.7.6",
"build" : "21H1320",
"releaseType" : "User"
},
"captureTime" : "2026-06-25 08:18:29.5568 +0800",
"incident" : "58FD5532-D53B-4081-814E-333640477C16",
"bug_type" : "309",
"pid" : 10104,
"procExitAbsTime" : 4235656726456628,
"cpuType" : "X86-64",
"procName" : "Steam++",
"procPath" : "/Applications/Steam++.app/Contents/MacOS/Steam++",
"bundleInfo" : {"CFBundleShortVersionString":"3.1.0","CFBundleVersion":"3.1.2021.0","CFBundleIdentifier":"net.steampp.app"},
"storeInfo" : {"deviceIdentifierForVendor":"296629E1-E484-56E1-A8C5-1045296D9E25","thirdParty":true},
"parentProc" : "launchd",
"parentPid" : 1,
"coalitionName" : "net.steampp.app",
"crashReporterKey" : "CD5EDFC1-1B66-4689-C409-736D2CE355EB",
"wakeTime" : 435473,
"sleepWakeUUID" : "CA4B18C6-FB05-4FE3-9A16-0572A2D25A00",
"sip" : "enabled",
"isCorpse" : 1,
"exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"},
"termination" : {"code":1,"flags":518,"namespace":"DYLD","indicator":"Library missing","details":["(terminated at launch; ignore backtrace)"],"reasons":["Library not loaded: 'libonigwrap.dylib'","Referenced from: '/Applications/Steam++.app/Contents/MacOS/Steam++'","Reason: tried: 'libonigwrap.dylib' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file)"]},
"extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
"faultingThread" : 0,
"threads" : [{"triggered":true,"id":28830515,"threadState":{"r13":{"value":140701792684528},"rax":{"value":33554953},"rflags":{"value":582},"cpu":{"value":0},"r14":{"value":1},"rsi":{"value":1},"r8":{"value":140701792683504},"cr2":{"value":0},"rdx":{"value":140701792684528},"r10":{"value":87},"r9":{"value":0},"r15":{"value":6},"rbx":{"value":0},"trap":{"value":133},"err":{"value":33554953},"r11":{"value":582},"rip":{"value":4756810146,"matchesCrashFrame":1},"rbp":{"value":140701792683472},"rsp":{"value":140701792683400},"r12":{"value":87},"rcx":{"value":140701792683400},"flavor":"x86_THREAD_STATE","rdi":{"value":6}},"frames":[{"imageOffset":289186,"symbol":"__abort_with_payload","symbolLocation":10,"imageIndex":0},{"imageOffset":379570,"symbol":"abort_with_payload_wrapper_internal","symbolLocation":80,"imageIndex":0},{"imageOffset":379620,"symbol":"abort_with_payload","symbolLocation":9,"imageIndex":0},{"imageOffset":42649,"symbol":"dyld4::halt(char const*)","symbolLocation":615,"imageIndex":0},{"imageOffset":26037,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":3995,"imageIndex":0},{"imageOffset":21732,"symbol":"start","symbolLocation":388,"imageIndex":0}]}],
"usedImages" : [
{
"source" : "P",
"arch" : "x86_64",
"base" : 4756520960,
"size" : 442368,
"uuid" : "eea022bb-a6ab-3cd1-8ac1-54ce8cfd3333",
"path" : "/usr/lib/dyld",
"name" : "dyld"
}
],
"sharedCache" : {
"base" : 140703483232256,
"size" : 19331678208,
"uuid" : "246818c3-4b9f-3462-bcaf-fdf71975e5fe"
},
"vmSummary" : "ReadOnly portion of Libraries: Total=23.1M resident=0K(0%) swapped_out_or_unallocated=23.1M(100%)\nWritable regions: Total=9.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9.9M(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nSTACK GUARD 56.0M 1 \nStack 8192K 1 \nVM_ALLOCATE 12K 3 \n__DATA 1684K 24 \n__DATA_CONST 416K 15 \n__LINKEDIT 6816K 19 \n__TEXT 16.5M 17 \ndyld private memory 1024K 1 \n=========== ======= ======= \nTOTAL 90.2M 81 \n",
"legacyInfo" : {
"threadTriggered" : {
}
},
"trialInfo" : {
"rollouts" : [
{
"rolloutId" : "6297d96be2c9387df974efa4",
"factorPackIds" : {
},
"deploymentId" : 240000032
},
{
"rolloutId" : "607844aa04477260f58a8077",
"factorPackIds" : {
"SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a"
},
"deploymentId" : 240000066
}
],
"experiments" : [
]
}
}
Model: MacBookPro11,4, BootROM 489.0.0.0.0, 4 processors, Quad-Core Intel Core i7, 2.2 GHz, 16 GB, SMC 2.29f24
Graphics: Intel Iris Pro, Intel Iris Pro, Built-In
Display: Color LCD, 2880 x 1800 Retina, Main, MirrorOff, Online
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x802C, 0x31364B544631473634485A2D314736453120
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x802C, 0x31364B544631473634485A2D314736453120
AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x152), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1710.4)
AirPort:
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM0512G, 500.28 GB
USB Device: USB30Bus
USB Device: Apple Internal Keyboard / Trackpad
USB Device: Bluetooth USB Host Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 27.1
经终端输入find /Applications/Steam++.app -name "*.dylib" | grep onig
和手动查找包文件内确认含有libonigwrap.dylib后,
检查文件完整是否损坏
file /Applications/Steam++.app/Contents/MonoBundle/libonigwrap.dylib
正常应该输出类似 Mach-O 64-bit dynamically linked shared library x86_64
于是验证文件完整,输入
##1. 查看主程序如何引用 libonigwrap.dylib
otool -L /Applications/Steam++.app/Contents/MacOS/Steam++ | grep onig
##2. 查看 libonigwrap.dylib 自身的安装名称
otool -D /Applications/Steam++.app/Contents/MonoBundle/libonigwrap.dylib
##3. 查看 libonigwrap.dylib 依赖的其他库
otool -L /Applications/Steam++.app/Contents/MonoBundle/libonigwrap.dylib
##4. 检查主程序所有的 LC_LOAD_DYLIB 和 LC_RPATH 信息
otool -l /Applications/Steam++.app/Contents/MacOS/Steam++ | grep -E "(LC_LOAD_DYLIB|LC_RPATH)" -A2
从输出可以看到otool -L 显示主程序对 libonigwrap.dylib 的引用是 libonigwrap.dylib(没有路径前缀)。
而 otool -l 的输出显示,主程序有多个 LC_LOAD_DYLIB,其中一条是 name libonigwrap.dylib (offset 24),确实没有 @rpath/ 或 @executable_path 前缀。
同时,输出中也显示了两个 LC_RPATH 条目,路径分别是 @executable_path/../MonoBundle/ 和 @executable_path/../MonoBundle(带和不带斜杠)。这两个路径都正确指向了 MonoBundle。
问题关键: 主程序对 libonigwrap.dylib 的加载命令是裸库名(无路径),而 dyld 对于这种裸库名,不会使用 @rpath。它只会搜索默认路径(如 /usr/lib、/usr/local/lib 等),而不会搜索 @rpath 指定的路径。这就是为什么即使添加了 rpath,dyld 仍然尝试空路径(即默认路径)而找不到。
解决方案:修改主程序对 libonigwrap.dylib 的加载命令,将其改为 @rpath/libonigwrap.dylib。
输入
install_name_tool -change libonigwrap.dylib @rpath/libonigwrap.dylib /Applications/Steam++.app/Contents/MacOS/Steam++
然后再重新签名(因为二进制被修改过):
codesign --force --deep --sign - /Applications/Steam++.app
双击启动 Steam++,应该可以正常打开了
在 macOS 中,裸库名的查找规则是只在默认系统库路径(如 /usr/lib、/usr/local/lib)中搜索,而不会使用 @rpath 指定的路径(即使你已经添加了正确的 rpath)。
原因是主程序对 libonigwrap.dylib 的引用是 裸库名(没有路径前缀) 解决方法在最后
第一次启动报错详细日志如下
Translated Report (Full Report Below)
Process: Steam++ [10104]
Path: /Applications/Steam++.app/Contents/MacOS/Steam++
Identifier: net.steampp.app
Version: 3.1.0 (3.1.2021.0)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2026-06-25 08:18:29.5568 +0800
OS Version: macOS 12.7.6 (21H1320)
Report Version: 12
Anonymous UUID: CD5EDFC1-1B66-4689-C409-736D2CE355EB
Sleep/Wake UUID: CA4B18C6-FB05-4FE3-9A16-0572A2D25A00
Time Awake Since Boot: 4200000 seconds
Time Since Wake: 435473 seconds
System Integrity Protection: enabled
Crashed Thread: 0
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace DYLD, Code 1 Library missing
Library not loaded: 'libonigwrap.dylib'
Referenced from: '/Applications/Steam++.app/Contents/MacOS/Steam++'
Reason: tried: 'libonigwrap.dylib' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file)
(terminated at launch; ignore backtrace)
Thread 0 Crashed:
0 dyld 0x11b8729a2 __abort_with_payload + 10
1 dyld 0x11b888ab2 abort_with_payload_wrapper_internal + 80
2 dyld 0x11b888ae4 abort_with_payload + 9
3 dyld 0x11b836699 dyld4::halt(char const*) + 615
4 dyld 0x11b8325b5 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3995
5 dyld 0x11b8314e4 start + 388
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000002000209 rbx: 0x0000000000000000 rcx: 0x00007ff7b05f4588 rdx: 0x00007ff7b05f49f0
rdi: 0x0000000000000006 rsi: 0x0000000000000001 rbp: 0x00007ff7b05f45d0 rsp: 0x00007ff7b05f4588
r8: 0x00007ff7b05f45f0 r9: 0x0000000000000000 r10: 0x0000000000000057 r11: 0x0000000000000246
r12: 0x0000000000000057 r13: 0x00007ff7b05f49f0 r14: 0x0000000000000001 r15: 0x0000000000000006
rip: 0x000000011b8729a2 rfl: 0x0000000000000246 cr2: 0x0000000000000000
Logical CPU: 0
Error Code: 0x02000209
Trap Number: 133
Binary Images:
0x11b82c000 - 0x11b897fff dyld (*) /usr/lib/dyld
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=23.1M resident=0K(0%) swapped_out_or_unallocated=23.1M(100%)
Writable regions: Total=9.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9.9M(100%)
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
STACK GUARD 56.0M 1
Stack 8192K 1
VM_ALLOCATE 12K 3
__DATA 1684K 24
__DATA_CONST 416K 15
__LINKEDIT 6816K 19
__TEXT 16.5M 17
dyld private memory 1024K 1
=========== ======= =======
TOTAL 90.2M 81
Full Report
{"app_name":"Steam++","timestamp":"2026-06-25 08:18:29.00 +0800","app_version":"3.1.0","slice_uuid":"5daf5fae-0f5a-3d7f-b452-498846fbc4f0","build_version":"3.1.2021.0","platform":1,"bundleID":"net.steampp.app","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.7.6 (21H1320)","incident_id":"58FD5532-D53B-4081-814E-333640477C16","name":"Steam++"}
{
"uptime" : 4200000,
"procLaunch" : "2026-06-25 08:18:29.5416 +0800",
"procRole" : "Default",
"version" : 2,
"userID" : 501,
"deployVersion" : 210,
"modelCode" : "MacBookPro11,4",
"procStartAbsTime" : 4235656712998950,
"coalitionID" : 391853,
"osVersion" : {
"train" : "macOS 12.7.6",
"build" : "21H1320",
"releaseType" : "User"
},
"captureTime" : "2026-06-25 08:18:29.5568 +0800",
"incident" : "58FD5532-D53B-4081-814E-333640477C16",
"bug_type" : "309",
"pid" : 10104,
"procExitAbsTime" : 4235656726456628,
"cpuType" : "X86-64",
"procName" : "Steam++",
"procPath" : "/Applications/Steam++.app/Contents/MacOS/Steam++",
"bundleInfo" : {"CFBundleShortVersionString":"3.1.0","CFBundleVersion":"3.1.2021.0","CFBundleIdentifier":"net.steampp.app"},
"storeInfo" : {"deviceIdentifierForVendor":"296629E1-E484-56E1-A8C5-1045296D9E25","thirdParty":true},
"parentProc" : "launchd",
"parentPid" : 1,
"coalitionName" : "net.steampp.app",
"crashReporterKey" : "CD5EDFC1-1B66-4689-C409-736D2CE355EB",
"wakeTime" : 435473,
"sleepWakeUUID" : "CA4B18C6-FB05-4FE3-9A16-0572A2D25A00",
"sip" : "enabled",
"isCorpse" : 1,
"exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"},
"termination" : {"code":1,"flags":518,"namespace":"DYLD","indicator":"Library missing","details":["(terminated at launch; ignore backtrace)"],"reasons":["Library not loaded: 'libonigwrap.dylib'","Referenced from: '/Applications/Steam++.app/Contents/MacOS/Steam++'","Reason: tried: 'libonigwrap.dylib' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file)"]},
"extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
"faultingThread" : 0,
"threads" : [{"triggered":true,"id":28830515,"threadState":{"r13":{"value":140701792684528},"rax":{"value":33554953},"rflags":{"value":582},"cpu":{"value":0},"r14":{"value":1},"rsi":{"value":1},"r8":{"value":140701792683504},"cr2":{"value":0},"rdx":{"value":140701792684528},"r10":{"value":87},"r9":{"value":0},"r15":{"value":6},"rbx":{"value":0},"trap":{"value":133},"err":{"value":33554953},"r11":{"value":582},"rip":{"value":4756810146,"matchesCrashFrame":1},"rbp":{"value":140701792683472},"rsp":{"value":140701792683400},"r12":{"value":87},"rcx":{"value":140701792683400},"flavor":"x86_THREAD_STATE","rdi":{"value":6}},"frames":[{"imageOffset":289186,"symbol":"__abort_with_payload","symbolLocation":10,"imageIndex":0},{"imageOffset":379570,"symbol":"abort_with_payload_wrapper_internal","symbolLocation":80,"imageIndex":0},{"imageOffset":379620,"symbol":"abort_with_payload","symbolLocation":9,"imageIndex":0},{"imageOffset":42649,"symbol":"dyld4::halt(char const*)","symbolLocation":615,"imageIndex":0},{"imageOffset":26037,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":3995,"imageIndex":0},{"imageOffset":21732,"symbol":"start","symbolLocation":388,"imageIndex":0}]}],
"usedImages" : [
{
"source" : "P",
"arch" : "x86_64",
"base" : 4756520960,
"size" : 442368,
"uuid" : "eea022bb-a6ab-3cd1-8ac1-54ce8cfd3333",
"path" : "/usr/lib/dyld",
"name" : "dyld"
}
],
"sharedCache" : {
"base" : 140703483232256,
"size" : 19331678208,
"uuid" : "246818c3-4b9f-3462-bcaf-fdf71975e5fe"
},
"vmSummary" : "ReadOnly portion of Libraries: Total=23.1M resident=0K(0%) swapped_out_or_unallocated=23.1M(100%)\nWritable regions: Total=9.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9.9M(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nSTACK GUARD 56.0M 1 \nStack 8192K 1 \nVM_ALLOCATE 12K 3 \n__DATA 1684K 24 \n__DATA_CONST 416K 15 \n__LINKEDIT 6816K 19 \n__TEXT 16.5M 17 \ndyld private memory 1024K 1 \n=========== ======= ======= \nTOTAL 90.2M 81 \n",
"legacyInfo" : {
"threadTriggered" : {
}
},
"trialInfo" : {
"rollouts" : [
{
"rolloutId" : "6297d96be2c9387df974efa4",
"factorPackIds" : {
],
"experiments" : [
]
}
}
Model: MacBookPro11,4, BootROM 489.0.0.0.0, 4 processors, Quad-Core Intel Core i7, 2.2 GHz, 16 GB, SMC 2.29f24
Graphics: Intel Iris Pro, Intel Iris Pro, Built-In
Display: Color LCD, 2880 x 1800 Retina, Main, MirrorOff, Online
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x802C, 0x31364B544631473634485A2D314736453120
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x802C, 0x31364B544631473634485A2D314736453120
AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x152), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1710.4)
AirPort:
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM0512G, 500.28 GB
USB Device: USB30Bus
USB Device: Apple Internal Keyboard / Trackpad
USB Device: Bluetooth USB Host Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 27.1
经终端输入find /Applications/Steam++.app -name "*.dylib" | grep onig
和手动查找包文件内确认含有libonigwrap.dylib后,
检查文件完整是否损坏
file /Applications/Steam++.app/Contents/MonoBundle/libonigwrap.dylib
正常应该输出类似 Mach-O 64-bit dynamically linked shared library x86_64
于是验证文件完整,输入
##1. 查看主程序如何引用 libonigwrap.dylib
otool -L /Applications/Steam++.app/Contents/MacOS/Steam++ | grep onig
##2. 查看 libonigwrap.dylib 自身的安装名称
otool -D /Applications/Steam++.app/Contents/MonoBundle/libonigwrap.dylib
##3. 查看 libonigwrap.dylib 依赖的其他库
otool -L /Applications/Steam++.app/Contents/MonoBundle/libonigwrap.dylib
##4. 检查主程序所有的 LC_LOAD_DYLIB 和 LC_RPATH 信息
otool -l /Applications/Steam++.app/Contents/MacOS/Steam++ | grep -E "(LC_LOAD_DYLIB|LC_RPATH)" -A2
从输出可以看到otool -L 显示主程序对 libonigwrap.dylib 的引用是 libonigwrap.dylib(没有路径前缀)。
而 otool -l 的输出显示,主程序有多个 LC_LOAD_DYLIB,其中一条是 name libonigwrap.dylib (offset 24),确实没有 @rpath/ 或 @executable_path 前缀。
同时,输出中也显示了两个 LC_RPATH 条目,路径分别是 @executable_path/../MonoBundle/ 和 @executable_path/../MonoBundle(带和不带斜杠)。这两个路径都正确指向了 MonoBundle。
问题关键: 主程序对 libonigwrap.dylib 的加载命令是裸库名(无路径),而 dyld 对于这种裸库名,不会使用 @rpath。它只会搜索默认路径(如 /usr/lib、/usr/local/lib 等),而不会搜索 @rpath 指定的路径。这就是为什么即使添加了 rpath,dyld 仍然尝试空路径(即默认路径)而找不到。
解决方案:修改主程序对 libonigwrap.dylib 的加载命令,将其改为 @rpath/libonigwrap.dylib。
输入
install_name_tool -change libonigwrap.dylib @rpath/libonigwrap.dylib /Applications/Steam++.app/Contents/MacOS/Steam++
然后再重新签名(因为二进制被修改过):
codesign --force --deep --sign - /Applications/Steam++.app
双击启动 Steam++,应该可以正常打开了
在 macOS 中,裸库名的查找规则是只在默认系统库路径(如 /usr/lib、/usr/local/lib)中搜索,而不会使用 @rpath 指定的路径(即使你已经添加了正确的 rpath)。