ToddX61
ToddX61

Reputation: 693

Unable to run Swift Package Manager (macOS 10.14.4)

When I try 'swift package' in a terminal window, the following is displayed:

dyld: Library not loaded: @rpath/llbuild.framework/Versions/A/llbuild
Referenced from: /Library/Developer/CommandLineTools/usr/bin/swift-package 
    Reason: image not found
    Abort trap: 6

I thought maybe it had to do with updating to Xcode 10.2 and Swift 5? I've never messed around with the package manager before updating. And I'm no shell guru, either.

Anyway, here's the 'swift version' output if it's relevant:

Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Target: x86_64-apple-darwin18.5.0

Upvotes: 27

Views: 5571

Answers (2)

Salavert
Salavert

Reputation: 761

I fixed my problem by opening "Xcode > Preferences > Locations > Command Line Tools" was not filled so I chose one from list

enter image description here

Upvotes: 58

ToddX61
ToddX61

Reputation: 693

Coincidentally, I found the solution after trying to install MacPorts, which gave me the error:

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

The solution (from here) was to:

Point xcode-select to the Xcode app Developer directory using the following command: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Command 'swift package' then ran as expected.

Upvotes: 23

Related Questions