# Xcode exit code 65

**URL:** <https://discuss.circleci.com/t/xcode-exit-code-65/4284>\
**Category:** Mobile\
**Tags:** xcode\
**Created:** [May 31, 2016, 11:35am UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284 "2016-05-31T11:35:02Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![raihan](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/raihan/32/13682_2.png) [@raihan](https://discuss.circleci.com/u/raihan)\
**Post date:** [August 14, 2016, 5:57pm UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/22 "2016-08-14T17:57:37Z")

</div>

Hello, I was also getting this Xcode exit code 65 issue. It was generated from **UITests Scheme**. For me **UITests Scheme** was not much important as I have only functional test coverage, so I deleted the **UITests Scheme** & able to run all test cases without any issue.  
May this help for few people.

---

<div class="post-metadata">

**Author:** ![mattyohe](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mattyohe/32/2612_2.png) [@mattyohe](https://discuss.circleci.com/u/mattyohe)\
**Post date:** [September 8, 2016, 2:46am UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/23 "2016-09-08T02:46:04Z")

</div>

> isolated some really promising root causes and we’re testing

I assume this didn’t get anywhere?

Is this still present on Xcode 8 builds as well?

---

<div class="post-metadata">

**Author:** ![rishimkumar](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rishimkumar/32/4798_2.png) [@rishimkumar](https://discuss.circleci.com/u/rishimkumar)\
**Post date:** [September 8, 2016, 4:44pm UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/24 "2016-09-08T16:44:11Z")

</div>

@anon47539524’s post covered what ended up being the majority of cases. If you’re still having issues, let us know! Exit Code 65 is a generic Apple error code so I fully expect that there are still many of them - just less now.

---

<div class="post-metadata">

**Author:** ![ben\_hinge](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/ben_hinge/32/1337_2.png) [@ben\_hinge](https://discuss.circleci.com/u/ben_hinge)\
**Post date:** [September 21, 2016, 5:09pm UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/25 "2016-09-21T17:09:36Z")

</div>

The issue reappeared in XCode 8 and the workaround is not working for us any longer:  
When using the workaround as following:

```auto
pre:
    - xcrun instruments -w '2D96E690-BFB5-44D5-8B22-31D9C57EDADF' || true
    - sleep 15

```

I’m seeing the following error

```auto
Instruments Usage Error: No template (-t) specified
instruments, version 8.0 

```

Any ideas?

---

<div class="post-metadata">

**Author:** ![anon47539524](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon47539524](https://discuss.circleci.com/u/anon47539524)\
**Post date:** [September 21, 2016, 6:14pm UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/26 "2016-09-21T18:14:06Z")

</div>

Hey Ben,

Could you please open a support ticket and provide this link as a reference so that it’ll end up with me. Please also link to the failed builds.

Best,  
Constantin

---

<div class="post-metadata">

**Author:** ![ndonald2](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/ndonald2/32/13516_2.png) [@ndonald2](https://discuss.circleci.com/u/ndonald2)\
**Post date:** [October 11, 2016, 3:17pm UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/27 "2016-10-11T15:17:54Z")

</div>

I am having the same issue as Ben with Xcode 8. The fix no longer works. I would greatly appreciate if you could keep this thread up to date rather than having to communicate on an individual basis as I’m sure others are having the same issue.

Thanks!

---

<div class="post-metadata">

**Author:** ![ndonald2](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/ndonald2/32/13516_2.png) [@ndonald2](https://discuss.circleci.com/u/ndonald2)\
**Post date:** [October 12, 2016, 4:47pm UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/28 "2016-10-12T16:47:55Z")

</div>

For those wondering, here are the simulator UUIDs for iOS 10 that are available in the build container. I got these by SSH-ing into one of my builds and invoking `xcrun simctl list` with `DEVELOPER_DIR` set to the Xcode 8 directory. I’ve only tried the iPhone 6 one but it seems to be working correctly.

```auto
-- iOS 10.0 --
    iPhone 5 (85D8FE66-1208-4478-811C-7BD1AA3B33CA) (Shutdown)
    iPhone 5s (1FB033A8-440D-45F3-B95D-03E4E38B51DF) (Shutdown)
    iPhone 6 (33D34EBA-703E-4A82-8838-BE75171492E1) (Shutdown)
    iPhone 6 Plus (5525775C-A351-4986-9BF4-144A84E253AA) (Shutdown)
    iPhone 6s (F08BA729-6AD2-42DF-A210-34DC8D990011) (Shutdown)
    iPhone 6s Plus (A310FC97-435A-4026-AF85-F1216F856BA5) (Shutdown)
    iPhone 7 (2D96E690-BFB5-44D5-8B22-31D9C57EDADF) (Shutdown)
    iPhone 7 Plus (D4155E82-B930-450B-AFC7-F4800669EC65) (Shutdown)
    iPhone SE (84A11478-B7D4-4968-A626-E27CE7372148) (Shutdown)
    iPad Retina (D56EBD40-B853-4D56-B482-D4C40E69A3FC) (Shutdown)
    iPad Air (B9257F59-88B3-421D-B1F2-2BD92F0858D0) (Shutdown)
    iPad Air 2 (AC291080-8EFE-4095-8C55-B1E952EFFC36) (Shutdown)
    iPad Pro (9.7 inch) (F9C94E2A-F080-4AB0-93D6-A41135919D8E) (Shutdown)
    iPad Pro (12.9 inch) (BF8D8AD2-6A96-4A62-8059-A836738BB873) (Shutdown)

```

---

<div class="post-metadata">

**Author:** ![anon47539524](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon47539524](https://discuss.circleci.com/u/anon47539524)\
**Post date:** [October 13, 2016, 1:16pm UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/29 "2016-10-13T13:16:19Z")

</div>

Hey,

I’ve created a new thread in order to keep better track of this here: [Xcode Exit Code 65 + UI Tests](https://discuss.circleci.com/t/xcode-exit-code-65-ui-tests/7201/3)

I’m working on it nonstop but I haven’t yet found a solution.

---

<div class="post-metadata">

**Author:** ![tristandl](https://avatars.discourse-cdn.com/v4/letter/t/7c8e57/32.png) [@tristandl](https://discuss.circleci.com/u/tristandl)\
**Post date:** [November 7, 2016, 3:18am UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/30 "2016-11-07T03:18:51Z")

</div>

ditto to this - i’m having UI tests consistantly fail when they pass locally. it seems that the simulator isn’t loading for a particular test suite

---

<div class="post-metadata">

**Author:** ![alexey](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/alexey/32/42_2.png) [@alexey](https://discuss.circleci.com/u/alexey)\
**Post date:** [January 16, 2017, 10:08am UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/31 "2017-01-16T10:08:07Z")

</div>

We no longer recommend using UUIDs to start simulators. The OS X image has been updated to resolve the underlying issue with multiple simulators available for the same device type and iOS version, and using UUIDs is no longer necessary. Please check out [this post](https://discuss.circleci.com/t/os-x-build-image-update-xcode-8-2/9355) for examples of how to choose the simulators by name, both in `xcodebuild` commands and when pre-starting the simulator.

---

<div class="post-metadata">

**Author:** ![ajauntyshark](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@ajauntyshark](https://discuss.circleci.com/u/ajauntyshark)\
**Post date:** [March 2, 2017, 8:10pm UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/32 "2017-03-02T20:10:13Z")

</div>

If you’re running into the error code 65 here’s a command you can pipe on the end of your `xcodebuild` (assuming you’re running tests) command to get back more consistent results:

`(XCODEBUILD_COMMAND_HERE) | awk 'BEGIN {success=0} $0 ~ /.* tests, with 0 failures \(.*/ {success=1} {print $0} END {if(success==0){exit 1}}`

This looks for `tests, with 0 failures (` in your output text, thus using the text output of `xcodebuild` instead of the status code of `xcodebuild` to determine success.

Note: Keep in mind, if you do something like `NSLog(' tests, with 0 failures (');` in your code you make get a false positive, it’s very unlikely to happen by accident. You may have to update `tests, with 0 failures (` in the awk script between updates of `xcodebuild`. But, having consistent results with `xcodebuild` is definitely worth that price.

---

<div class="post-metadata">

**Author:** ![mattyohe](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mattyohe/32/2612_2.png) [@mattyohe](https://discuss.circleci.com/u/mattyohe)\
**Post date:** [April 19, 2017, 12:43am UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/33 "2017-04-19T00:43:28Z")

</div>

After months of off and on issues, we have completely resolved our Error 65 issues and this solution has been in place over several hundred builds across the past 20 days.

The key has been separating the steps in our `Makefile` for performing a `xcodebuild build`, and `xcodebuild test`. This builds as expected in the first step, and then runs tests with derived data from the previous step.

[Here’s a relevant portion of our Makefile if the above is not clear](https://gist.github.com/mattyohe/31552b6543ae0cf2fdca912c29e9bb17#file-makefile).

If I don’t respond here right away, feel free to reach out to me on [Twitter](https://twitter.com/mattyohe). Hope this helps others!

---

<div class="post-metadata">

**Author:** ![anon47539524](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon47539524](https://discuss.circleci.com/u/anon47539524)\
**Post date:** [April 28, 2017, 8:22am UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/34 "2017-04-28T08:22:41Z")

</div>

Hey everyone,

Please checkout this post: I’m looking to gather as much information as I possibly can in order to help Apple improve xcodebuild and the underlying toolchain for all of us.

If you’re interested please E-Mail me. All the data will be anonymized!

> [@Call for iOS projects with Exit Code 65 issues](https://discuss.circleci.com/t/call-for-ios-projects-with-exit-code-65-issues/12262):
>
> Hey dear iOS and macOS developers, I’m going to do some scientific-ish investigations into xcodebuilds exit code 65 in order to be able to hand Apple’s Developer Tools Team better information about what is going wrong and how we can fix these issues for good. If you still have systemic issues with xcodebuild exit code 65 and you think you tried all the possible workarounds that were developed by CircleCI then please contact me directly at constantin[at][circleci.com](http://circleci.com) . Please include link(s) to…

---

<div class="post-metadata">

**Author:** ![karlisl](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/karlisl/32/10576_2.png) [@karlisl](https://discuss.circleci.com/u/karlisl)\
**Post date:** [June 1, 2017, 12:30pm UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/35 "2017-06-01T12:30:59Z")

</div>

Hello!

We managed to fix this issue by running:  
`xcodebuild build-for-testing` …  
`xcodebuild test-without-building` …

instead of `build` and `test`. [You can read about this in details here.](http://shashikantjagtap.net/speed-ios-ci-using-test-without-building-xctestrun-fastlane/)

I hope this will help some of you, cheers!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:33am UTC](https://discuss.circleci.com/t/xcode-exit-code-65/4284/36 "2018-06-18T11:33:28Z")

</div>



[Previous page](https://discuss.circleci.com/t/xcode-exit-code-65/4284.md?page=1)
