# Telling Xcode 14 beta 4 to trust build tool plugins programatically

**URL:** <https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305>\
**Category:** Using Swift\
**Tags:** xcode, packagemanager, buildtoolplugin, xcode-cloud\
**Created:** [July 28, 2022, 11:49pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305 "2022-07-28T23:49:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke\_Lau](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/luke_lau/32/648_2.png) [@Luke\_Lau](https://forums.swift.org/u/Luke_Lau)\
**Post date:** [July 28, 2022, 11:49pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/1 "2022-07-28T23:49:55Z")

</div>

In Xcode 14 beta 4, build tool plugins need to be trusted before they can be run now, which works fine on my local Xcode instance by following the instructions in the alert dialogue.

However, on Xcode cloud I'm just given an error immediately after starting the archive:

```swift
Showing All Messages

Archiving project Foo with scheme Foo of project Foo

Prepare packages
Validate plug-in “CodegenPlugin” in package “mypackage”
“CodegenPlugin” is disabled

Plug-in “CodegenPlugin” is implemented here

```

From what I can tell, there's no state or flag stored in the Xcode project files or anything else that is checked in. Is there an environment variable or flag I can set to tell Xcode cloud to trust my build tool plugin?

---

<div class="post-metadata">

**Author:** ![pyrtsa](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/pyrtsa/32/740_2.png) [@pyrtsa](https://forums.swift.org/u/pyrtsa)\
**Post date:** [July 29, 2022, 8:09am UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/2 "2022-07-29T08:09:21Z")

</div>

Seems `xcodebuild` has a new option `-skipPackagePluginValidation` in Xcode 14.0 beta 4:

> Skip validation of package plugins (this can be a security risk if they are not from trusted sources)

I'm guessing that's what you're after?

---

<div class="post-metadata">

**Author:** ![Luke\_Lau](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/luke_lau/32/648_2.png) [@Luke\_Lau](https://forums.swift.org/u/Luke_Lau)\
**Post date:** [July 29, 2022, 10:05am UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/3 "2022-07-29T10:05:48Z")

</div>

Yup, this looks like what I'm looking for, thanks! The only problem now is to figure out how to pass it to Xcode Cloud. There doesn't seem to be any option for passing `xcodebuild` arguments in the edit workflow screen, only a table for environment variables.

---

<div class="post-metadata">

**Author:** ![Dan\_Thorpe](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dan_thorpe/32/2507_2.png) [@Dan\_Thorpe](https://forums.swift.org/u/Dan_Thorpe)\
**Post date:** [September 25, 2022, 1:44pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/4 "2022-09-25T13:44:44Z")

</div>

Hi @Luke_Lau - did you ever figure out a solution to this?

Seems like you cannot use Swift Package Plugins, or any dependency which might use them, if you also want to use Xcode Cloud. Which is a bit of a deal breaker - as it's highly likely that open source packages will start making use of them.

---

<div class="post-metadata">

**Author:** ![Luke\_Lau](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/luke_lau/32/648_2.png) [@Luke\_Lau](https://forums.swift.org/u/Luke_Lau)\
**Post date:** [September 25, 2022, 2:11pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/5 "2022-09-25T14:11:46Z")

</div>

Unfortunately no, not with Xcode cloud. We’ve had to stop using Xcode cloud for this reason

---

<div class="post-metadata">

**Author:** ![Dan\_Thorpe](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dan_thorpe/32/2507_2.png) [@Dan\_Thorpe](https://forums.swift.org/u/Dan_Thorpe)\
**Post date:** [September 25, 2022, 2:50pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/6 "2022-09-25T14:50:41Z")

</div>

Thanks @Luke_Lau - I guess back to GitHub Actions it is.

---

<div class="post-metadata">

**Author:** ![jakepetroules](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jakepetroules/32/5229_2.png) [@jakepetroules](https://forums.swift.org/u/jakepetroules)\
**Post date:** [September 25, 2022, 6:36pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/7 "2022-09-25T18:36:28Z")

</div>

In Xcode Cloud you can use [custom build scripts](https://developer.apple.com/documentation/xcode/writing-custom-build-scripts) (ci\_post\_clone.sh) to set the following user default:

```nohighlight
defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES

```

This will have the same effect as passing `-skipPackagePluginValidation`.

---

<div class="post-metadata">

**Author:** ![Luke\_Lau](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/luke_lau/32/648_2.png) [@Luke\_Lau](https://forums.swift.org/u/Luke_Lau)\
**Post date:** [September 25, 2022, 8:27pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/8 "2022-09-25T20:27:41Z")

</div>

Just stuck it into my pre build script, it worked perfectly. Thanks! Is this documented anywhere or is it considered internal?

---

<div class="post-metadata">

**Author:** ![bennyyy999](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/bennyyy999/32/33827_2.png) [@bennyyy999](https://forums.swift.org/u/bennyyy999)\
**Post date:** [January 27, 2024, 9:24pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/9 "2024-01-27T21:24:58Z")

</div>

@jakepetroules @Luke_Lau  
This doesn't seem to work anymore or am I doing something wrong here?

---

<div class="post-metadata">

**Author:** ![jaredsinclair](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jaredsinclair/32/4353_2.png) [@jaredsinclair](https://forums.swift.org/u/jaredsinclair)\
**Post date:** [January 31, 2024, 4:39pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/10 "2024-01-31T16:39:49Z")

</div>

> This doesn't seem to work anymore or am I doing something wrong here?

Same here. I've tried both this (the verbatim text from @jakepetroules):

```swift
defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES

```

And I've tried variations of the flag (fixing the typos in the original above) like:

- `IDESkipPackagePluginFingerprintValidation`
- `IDESkipPackagePluginValidation`

And in all cases, despite running either of the above in my `ci_post_clone.sh` script, Xcode Cloud still gives the following error:

```swift
error: “SwiftLint” must be enabled before it can be used

```

Because of this, there's currently no way to run _any_ Swift Package plugins from Xcode Cloud, SwiftLint or otherwise.

---

<div class="post-metadata">

**Author:** ![jaredsinclair](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jaredsinclair/32/4353_2.png) [@jaredsinclair](https://forums.swift.org/u/jaredsinclair)\
**Post date:** [March 20, 2024, 5:21pm UTC](https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/11 "2024-03-20T17:21:00Z")

</div>

**Update for Posterity**

It is possible to get Xcode Cloud to trust build tool plugins programmatically. Here are the steps required:

1. In the same directory as your project/workspace, create a directory named `ci_scripts` containing a file named `ci_post_clone.sh`. Exactly those names.

2. In the script, execute the following statements: `defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES` and `defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES`. Exactly those statements, including the misspelling (vali **data** ion).

3. If you haven't already, track your project/workspace `Package.resolved` file in source control. Can't git-ignore it, or else Xcode Cloud refuses to proceed.

4. I'm assuming you've also done all the clicking and typing and logging in necessary to connect your Xcode project, your Xcode Cloud project, and your source control, but one step in there is easy to miss, because the Xcode wizard that walks you through granting source control (say, GitHub) access to Xcode Cloud will give you a green checkmark saying "You're done!" before you're actually done. The very last step requires logging into App Store Connect one last time, and granting Xcode Cloud your permission to access the repositories, again. If you miss this step, package resolution will fail.

With all this in place, Xcode Cloud should be to check out your source, resolve packages (including public-hosted, private-hosted, and local packages), and run builds/tests, automatically trusting build plugins included among your packages.

BIG CAVEAT: As of Xcode 15, build tool plugins are no longer allowed to modify source code in situ. Code generation plugins, like Protobuf, are only permitted to write source to a temporary directory. Any existing workflows you have that were built on a capacity to generate version-control-tracked source in CI are not gonna work.
