# Only Command Line Tools installed, xctest executable not found

**URL:** <https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088>\
**Category:** Using Swift\
**Created:** [February 25, 2020, 5:52pm UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088 "2020-02-25T17:52:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![derhuerst](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/derhuerst/32/12412_2.png) [@derhuerst](https://forums.swift.org/u/derhuerst)\
**Post date:** [February 25, 2020, 5:52pm UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088/1 "2020-02-25T17:52:06Z")

</div>

Hey,

I created a Swift executable package using `swift package init --type executable`. When running `swift build` or `swift run`, it tries to find `xctest` but fails.

```nohighlight
swift build
# error: terminated(72): xcrun --sdk macosx --find xctest output:
# xcrun: error: unable to find utility "xctest", not a developer tool or in PATH

```

I have just (re-)installed a fresh Command Line Tools version. I don't want to (and don't have the disk space available) to download XCode. `xcode-select --reset` does not help either.

- macOS `10.15.3`
- `xcode-select` version `2373`
- Swift version `5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)`

**How can I build the package, without `swift build` looking for `xctest`?**

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![jrmoulton](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrmoulton/32/12656_2.png) [@jrmoulton](https://forums.swift.org/u/jrmoulton)\
**Post date:** [July 8, 2020, 4:06am UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088/2 "2020-07-08T04:06:23Z")

</div>

I've run into the same issue. Did you ever find a solution without using Xcode?

---

<div class="post-metadata">

**Author:** ![derhuerst](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/derhuerst/32/12412_2.png) [@derhuerst](https://forums.swift.org/u/derhuerst)\
**Post date:** [July 8, 2020, 1:13pm UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088/3 "2020-07-08T13:13:46Z")

</div>

i haven‘t found a solution so far, but i also haven‘t looked into it further.

---

<div class="post-metadata">

**Author:** ![PotentialSteffan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/potentialsteffan/32/14679_2.png) [@PotentialSteffan](https://forums.swift.org/u/PotentialSteffan)\
**Post date:** [January 3, 2021, 6:47am UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088/4 "2021-01-03T06:47:20Z")

</div>

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer  
this make sense to me

---

<div class="post-metadata">

**Author:** ![jonprescott](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jonprescott](https://forums.swift.org/u/jonprescott)\
**Post date:** [January 4, 2021, 12:18am UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088/5 "2021-01-04T00:18:17Z")

</div>

This requires that you have Xcode installed, which previous posters did not want to install.

---

<div class="post-metadata">

**Author:** ![YTG1234](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ytg1234/32/15075_2.png) [@YTG1234](https://forums.swift.org/u/YTG1234)\
**Post date:** [January 26, 2021, 7:46am UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088/6 "2021-01-26T07:46:42Z")

</div>

22 days seem to have passed since the last comment. Has anyone found a solution?

---

<div class="post-metadata">

**Author:** ![woj-tek](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/woj-tek/32/15500_2.png) [@woj-tek](https://forums.swift.org/u/woj-tek)\
**Post date:** [February 23, 2021, 9:28am UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088/7 "2021-02-23T09:28:12Z")

</div>

Same issue here. I was trying to play with Swift and ran into this problem.

I've tried installing the swift package via brew but it also lacks `xctest` binary. For now, even being able to skip building/running test (to produce executable binary) would be fine.

(there is [GitHub - swiftwasm/swift-corelibs-xctest: The XCTest Project, A Swift core library for providing unit test support](https://github.com/swiftwasm/swift-corelibs-xctest) but it should be build with Xcode as it seems…)

---

<div class="post-metadata">

**Author:** ![riobah](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/riobah/32/18705_2.png) [@riobah](https://forums.swift.org/u/riobah)\
**Post date:** [July 12, 2021, 12:12pm UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088/8 "2021-07-12T12:12:25Z")

</div>

setting path helped me

export PATH=$PATH:/Applications/Xcode.app/Contents/Developer/usr/bin

---

<div class="post-metadata">

**Author:** ![woj-tek](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/woj-tek/32/15500_2.png) [@woj-tek](https://forums.swift.org/u/woj-tek)\
**Post date:** [July 12, 2021, 12:14pm UTC](https://forums.swift.org/t/only-command-line-tools-installed-xctest-executable-not-found/34088/9 "2021-07-12T12:14:39Z")

</div>

This is about situation when you only have Command Line Tools (i.e. without Xcode) so your solution won't work as in that case `/Applications/Xcode.app/Contents/Developer/usr/bin` doesn't exists.
