Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dyld: Library not loaded: @rpath/libswiftDispatch.dylib

I started to use XCode 9.2 (13772) a day ago and I was walking through some basic tutorials, when it crashed with the message:

  Library not loaded: @rpath/libswiftDispatch.dylib
  Referenced from: /Applications/Xcode.app/Contents/MacOS/Xcode
  Reason: image not found

Later I discovered that some other applications started to crash with the same message when I tried to open them. I reinstalled all those applications, including XCode, and it helped for all of them, but XCode. It still crashes the same way.

Does anybody have any ideas how to fix this? I would try to use AppCode, but it still relies on XCode and thus can't work until this issue is resolved.

Here's detailed stack from Apple's crash report:

Dyld Error Message:
  Library not loaded: @rpath/libswiftDispatch.dylib
  Referenced from: /Applications/Xcode.app/Contents/MacOS/Xcode
  Reason: image not found

Binary Images:
       0x1093db000 -        0x1093dcff7  com.apple.dt.Xcode (9.2 - 13772) <99E158D7-ADB3-3CD8-9762-716A74599C12> /Applications/Xcode.app/Contents/MacOS/Xcode
       0x1093e7000 -        0x10999dfff  com.apple.dt.DVTFoundation (9.2 - 13763) <78811324-8E42-36B8-81E3-74A1D4AC5F7E> /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation
       0x109c08000 -        0x109f85ff7  com.apple.dt.DVTKit (9.2 - 13763) <76F3AD2F-A605-3FC3-BF66-E09B2B991852> /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/DVTKit
       0x10a1df000 -        0x10a94efff  com.apple.dt.IDEFoundation (9.2 - 13772) <CC7015F9-971F-3C05-A3E9-2A20694D028B> /Applications/Xcode.app/Contents/Frameworks/IDEFoundation.framework/Versions/A/IDEFoundation
       0x10ae83000 -        0x10b842fff  com.apple.dt.IDEKit (9.2 - 13772) <C19A9742-1C5E-345D-B0A5-E2CB0D88EA39> /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/IDEKit
       0x10bf9b000 -        0x10bfa9fff +libswiftAVFoundation.dylib (4.0.3 - 900.0.74.1) <FC937BB3-D0FB-35D1-9270-FA2DC117821B> /Applications/Xcode.app/Contents/Frameworks/libswiftAVFoundation.dylib
       0x10bfb9000 -        0x10c37cfff +libswiftCore.dylib (4.0.3 - 900.0.74.1) <CE685663-7897-3330-83B6-74EEFE1A116F> /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib
       0x10c6b4000 -        0x10c6bbff7 +libswiftCoreAudio.dylib (4.0.3 - 900.0.74.1) <68E5B93C-487C-31C1-AC5D-4BFDCCF4B903> /Applications/Xcode.app/Contents/Frameworks/libswiftCoreAudio.dylib
       0x10c6ca000 -        0x10c6cdff7 +libswiftCoreFoundation.dylib (4.0.3 - 900.0.74.1) <51C48082-D5E2-34FD-9E5E-E5B822A3A1D4> /Applications/Xcode.app/Contents/Frameworks/libswiftCoreFoundation.dylib
       0x10c6d6000 -        0x10c6e6ff7 +libswiftCoreGraphics.dylib (4.0.3 - 900.0.74.1) <6EE1A751-4A73-3BFD-B683-6F232E2CA3BC> /Applications/Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib
       0x10c6ff000 -        0x10c704ffe +libswiftCoreImage.dylib (4.0.3 - 900.0.74.1) <CBA31255-A204-3F42-87F9-DC54338B97F0> /Applications/Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib
       0x10c70b000 -        0x10c715ff7 +libswiftCoreMedia.dylib (4.0.3 - 900.0.74.1) <6441DF57-06CB-3AFF-B52E-8CC230D11D97> /Applications/Xcode.app/Contents/Frameworks/libswiftCoreMedia.dylib
       0x10c71d000 -        0x10c723fff +libswiftDarwin.dylib (4.0.3 - 900.0.74.1) <0C6938A7-E862-3D6C-A235-0C9293F73141> /Applications/Xcode.app/Contents/Frameworks/libswiftDarwin.dylib
       0x11563d000 -        0x11568798f  dyld (519.2.2) <6695F30B-4E88-3C0B-9867-7D738C44A3E6> /usr/lib/dyld
    0x7fff3a388000 -     0x7fff3b1e5fff  com.apple.AppKit (6.9 - 1561.20.106) <D03AE413-C601-3B7C-A3D4-FC32F4C13940> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
    0x7fff3c5c8000 -     0x7fff3c5c8fff  com.apple.Cocoa (6.11 - 22) <1553F279-3C7B-3A48-87E6-35237F7F452E> /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
    0x7fff3cd62000 -     0x7fff3d202fe7  com.apple.CoreFoundation (6.9 - 1451) <7AFE9C8F-A562-3AFC-8402-117AA02F57E9> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff3ee98000 -     0x7fff3f25dfff  com.apple.Foundation (6.9 - 1451) <B99F94E7-117E-39CC-A65D-B7AEA8998481> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
    0x7fff624f9000 -     0x7fff624faff3  libSystem.B.dylib (1252) <47329E26-DC23-3EBA-9461-37755368327D> /usr/lib/libSystem.B.dylib
    0x7fff63afa000 -     0x7fff63ee87e7  libobjc.A.dylib (723) <93A92316-DE1E-378C-8891-99720B50D075> /usr/lib/libobjc.A.dylib
like image 891
Konstantin Statics Avatar asked Dec 06 '22 12:12

Konstantin Statics


2 Answers

I am using AVG Free for Mac. Yesterday it removed libswiftDispatch.dylib to quarantine because of 'MacOS:BitCoinMiner-AS'. This seems like a false positive, see: https://discussions.agilebits.com/discussion/86860/avg-quarantined-1password-libswiftdispatch-dylib/p2 https://forum.avast.com/index.php?topic=216164.msg1449648#msg1449648 (AVG and Avast are the same company)

So for me the fix was restoring this file from quarantine.

like image 158
user433205 Avatar answered Jan 01 '23 08:01

user433205


Looks like you are using Swift code in Objective-C project, right?
If so please be aware that:

"If you are building an app that does not use Swift but embeds content such as a framework that does, Xcode will not include these libraries in your app."

Apple docs

To fix your problem try the following steps:

  • go to your app target's Build Settings in Xcode
  • find Always Embed Swift Standard Libraries setting
  • set it from NO (which is default for Obj-C projects) to YES

After it clean the project (Shift+Cmd+K) and then build (Cmd+B) it again.

like image 26
Evgeny Karkan Avatar answered Jan 01 '23 10:01

Evgeny Karkan