Short answer

"Task failed with exit 1 signal 0" on a build that works in the simulator but not on an iPhone points at the device-only steps of the build, above all code signing; the line mentioning libswiftCore.dylib is the step that copies and signs Swift's libraries into the app. Clean the build folder, delete that project's DerivedData folder, and check that your signing identity is valid. Don't move certificates into the System keychain: Apple's documentation imports signing identities into the login keychain.

SWIFT TIPS · XCODE · CODE SIGNING

First posted on April 4, 2018, as "Error: Task failed with exit 1 signal 0 .... libswiftCore.dylib xcode 9.1 Swift". Rewritten on November 19, 2026. This post is based on Apple's documentation and the 2018 notes; no keychain or signing command was run for it, and no device build was made.

The 2018 post started from a question: a build worked in the simulator but failed on a real iPhone with "Task failed with exit 1 signal 0" and a line about libswiftCore.dylib. It gave two fixes. First, delete DerivedData with rm -rf, and if that didn't help, reinstall Xcode and restart the Mac. Second, close Xcode, open Keychain Access, drag the iOS Developer certificate from the Local keychain to the System keychain, enter the admin password and build again. The post closed with "Solution above work for me", without saying which of the two did it.

The DerivedData step is still a good first move. The keychain step is one I wouldn't repeat today, and this rewrite explains why, what the error is pointing at, and the order of things to try.

What the error is pointing at

"Exit 1" means a tool that Xcode ran during the build failed, and Xcode reported its exit status. The simulator and the device differ in one big way: apps for a device must be code signed, and so must every library inside them. In Xcode 9 the Swift runtime, including libswiftCore.dylib, was copied into each app and signed with your identity, so when signing failed, the error named that library. When a build works in the simulator and fails only for a device, look at signing first.

The full message is in the build log. Open the Report navigator, select the failed build, and expand the failed step: the lines under it show the real tool output, often a codesign error that says what's wrong.

Step 1: clean, and delete only this project's DerivedData

DerivedData holds Xcode's build products, indexes and logs, one folder per project, named after the project plus a random-looking suffix. Deleting a project's folder forces a fresh build. In Xcode, Product, Clean Build Folder (Shift-Command-K) does a smaller version of that for the open project. You rarely need to delete all of DerivedData: the "internal error" post linked below has a tested script that lists the folders with the project each belongs to and deletes only the one you name, after checking that Xcode is closed. Its first use is just listing, so you see what you're about to remove.

If you do delete everything by hand, check the path first. The 2018 command used an example home folder, /Users/johnDow, and a typo in an rm -rf path deletes the wrong thing without asking.

Step 2: check the signing settings

  1. Signing & Capabilities tab. For most projects, turn on "Automatically manage signing" and choose your team. Xcode creates and renews the certificate and profile it needs.
  2. Read the message under Signing. If the profile doesn't include the device, the certificate has expired, or the bundle ID isn't registered, Xcode says so there.
  3. Check the identity from Terminal. security find-identity -v -p codesigning lists valid signing identities on your Mac. An empty list, or a certificate missing from it, explains a device-only signing failure. I didn't run this for the post, since it reads the keychain.

The signing post linked below goes through "No signing certificate found" and the other common signing errors in more detail.

Why not move the certificate to the System keychain

The 2018 fix moved a personal signing identity, a certificate with its private key, into the System keychain, which is shared by every user of the Mac and needs an administrator to change. Apple's documentation on sharing signing certificates describes importing an identity into your login keychain. If a certificate only works from the System keychain, something else is wrong with the login keychain copy, for example a certificate whose private key is missing, or a trust setting changed by hand; fix that instead, or let Xcode create a new certificate with automatic signing.

Step 3: what's left

  • Restart the device and reconnect it, and accept the trust prompt on the device if one appears.
  • Update Xcode if the device runs an iOS version newer than your Xcode supports.
  • Reinstalling Xcode is the last resort, not the second step. It takes a long time and rarely fixes signing.

A quick check for your project

  1. When a build fails only on a device, open the build log and read the expanded failed step before changing anything.
  2. Use the script above to see how much space old DerivedData folders take, and delete the ones for projects you no longer build.
  3. If you once moved a certificate to the System keychain, check that it isn't still there next to a newer one in your login keychain.

What the 2018 version said

The post ended with a signature line and a LinkedIn link, which I left out.

Sources