Unable to compile Core Image filter on Xcode 26 due to missing Metal toolchain

I have a Core Image filter in my app that uses Metal. I cannot compile it because it complains that the executable tool metal is not available, but I have installed it in Xcode.

If I go to the "Components" section of Xcode Settings, it shows it as downloaded. And if I run the suggested command, it also shows it as installed. Any advice?

Xcode Version Version 26.0 beta (17A5241e)

Build Output


Showing All Errors Only

Build target Lessons of project StudyJapanese with configuration Light

RuleScriptExecution /Users/chris/Library/Developer/Xcode/DerivedData/StudyJapanese-glbneyedpsgxhscqueifpekwaofk/Build/Intermediates.noindex/StudyJapanese.build/Light-iphonesimulator/Lessons.build/DerivedSources/OtsuThresholdKernel.ci.air /Users/chris/Code/SerpentiSei/Shared/iOS/CoreImage/OtsuThresholdKernel.ci.metal normal undefined_arch (in target 'Lessons' from project 'StudyJapanese')
    cd /Users/chris/Code/SerpentiSei/StudyJapanese
    /bin/sh -c xcrun\ metal\ -w\ -c\ -fcikernel\ \"\$\{INPUT_FILE_PATH\}\"\ -o\ \"\$\{SCRIPT_OUTPUT_FILE_0\}\"'
'

error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain

/Users/chris/Code/SerpentiSei/StudyJapanese/error:1:1: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain



Build failed    6/9/25, 8:31 PM    27.1 seconds

Result of xcodebuild -downloadComponent MetalToolchain (after switching Xcode-beta.app with xcode-select)

xcodebuild -downloadComponent MetalToolchain
Beginning asset download...
Downloaded asset to: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/4d77809b60771042e514cfcf39662c6d1c195f7d.asset/AssetData/Restore/022-19457-035.dmg
Done downloading: Metal Toolchain (17A5241c).

Screenshots from Xcode

Result of "Copy Information" Metal Toolchain 26.0 [com.apple.MobileAsset.MetalToolchain: 17.0 (17A5241c)] (Installed)

Answered by DTS Engineer in 842416022

This is a known issue, and it's in the Xcode 26 Beta Release Notes.

Xcodebuild may fail to find the downloaded metal toolchain when building a project with metal shaders by command line. (152810434)

The workaround (noted in that release note) is to run these commands in Terminal:

xcodebuild -downloadComponent metalToolchain -exportPath /tmp/MyMetalExport/
 sed -i '' -e 's/17A5241c/17A5241e/g' /tmp/MyMetalExport/MetalToolchain-17A5241c.exportedBundle/ExportMetadata.plist
 xcodebuild -importComponent metalToolchain -importPath /tmp/MyMetalExport/MetalToolchain-17A5241c.exportedBundle

— Ed Ford,  DTS Engineer

This is a known issue, and it's in the Xcode 26 Beta Release Notes.

Xcodebuild may fail to find the downloaded metal toolchain when building a project with metal shaders by command line. (152810434)

The workaround (noted in that release note) is to run these commands in Terminal:

xcodebuild -downloadComponent metalToolchain -exportPath /tmp/MyMetalExport/
 sed -i '' -e 's/17A5241c/17A5241e/g' /tmp/MyMetalExport/MetalToolchain-17A5241c.exportedBundle/ExportMetadata.plist
 xcodebuild -importComponent metalToolchain -importPath /tmp/MyMetalExport/MetalToolchain-17A5241c.exportedBundle

— Ed Ford,  DTS Engineer

@FrankSchlegel said:

It's still not working. Do we need to remove the previous toolchain download somehow?

Can you give that a shot and let me know if you're still stuck after removing the downloaded toolchain?

— Ed Ford,  DTS Engineer

@DTS Engineer I tried that workaround, and am still seeing the issue. I have tried restarting my computer as well.

Interestingly, from the command line it now finds the metal toolchain, but it's still not working within Xcode, when using my build rules.

Command line (this used to complain about not being able to find metal toolchain, now it seems ok)

From Xcode, still getting the same error

Mine works by Deleting Xcode-beta.app , Reinstalling and follow the command line workaround (with "t" in "plist" in the second line) again

I also had this problem and already downloaded metal toolchain in XCode. I followed 3 line command line workaround from release note and found many error from

xcodebuild -deleteComponent metalToolchain

and importComponent again but it didn't work

I guessed that the reason mine didn't work while other people's worked may come from something that happened when I download the MetalToolchain component in Xcode may obstruct the commandline workaroound. So, I tried

  1. deleting the Xcode-beta.app,
  2. deleting things in /tmp folder that the commandline download.
  3. ensure anything else created when running 3 lines workaround not successfully was removed
  4. expand Xcode_26_beta.xip (redownloaded this if you didn't keep this file) into Xcode-beta.app
  5. Rerun 3 lines of workaround in the command line

After 3 commandlines run successfully, I recompile & run my xcodeproj that has .metal file and it just run smoothly with expected result as it used to be

Thanks WWDC Metal Lab Engineer (Rich & Mayur) who helped pointing me to this thread and everyone here who raised and solved the issue before I came here

@pichaya_TRYYS, thanks for sharing the detailed write up.

something not exist when running sed ... -> add the missing "t" to the plis at the end of the line

I see that I lost that trailing t during the editing of my copy, yikes. I've fixed my command above.

@cvasselli, perhaps this is why things aren't working for you. Can you go through and run the now corrected commands, and if that fails, removing the Xcode-beta.app and starting fresh in concert with my corrected command?

— Ed Ford,  DTS Engineer

Tried everything in this thread multiple times, the corrected command just fixes command line builds while building from Xcode still gives "error: cannot execute tool 'metal' due to missing Metal Toolchain"

Via Warren Moore, a solution that worked for me:

I’ve found that I’ve had to repeatedly use that xcodebuild incantation (after every reboot) and also mount the resulting .dmg file (which you can do by calling open path/to/downloaded/Package.dmg from the command line after the download finishes). Then Xcode seems to be able to find it.

Seems to be working with Xcode 26 beta 2, without any of the workarounds.

It no longer works for me under Xcode 26 beta 2, so I need to change the version number. change like this:

	xcodebuild -downloadComponent metalToolchain -exportPath /tmp/MyMetalExport/
	 sed -i '' -e 's/17A5241l/17A5241n/g' /tmp/MyMetalExport/MetalToolchain-17A5241c.exportedBundle/ExportMetadata.plist
	 xcodebuild -importComponent metalToolchain -importPath /tmp/MyMetalExport/MetalToolchain-17A5241c.exportedBundle

then reboot your mac right now.

Sorry, wrong path:

MetalToolchain-17A5241c.exportedBundle => MetalToolchain-17A5241l.exportedBundle

		xcodebuild -downloadComponent metalToolchain -exportPath /tmp/MyMetalExport/
		 sed -i '' -e 's/17A5241l/17A5241n/g' /tmp/MyMetalExport/MetalToolchain-17A5241l.exportedBundle/ExportMetadata.plist
		 xcodebuild -importComponent metalToolchain -importPath /tmp/MyMetalExport/MetalToolchain-17A5241l.exportedBundle

My complete script


xcodebuild -deleteComponent metalToolchain

sudo rm -rf ~/Library/Developer/DVTDownloads/MetalToolchain/

sudo rm -rf ~/Library/Developer/DVTDownloads/Assets/MetalToolchain/

sudo rm -rf /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/

rm -rf /tmp/MyMetalExport/

xcodebuild -downloadComponent metalToolchain -exportPath /tmp/MyMetalExport/

sed -i '' -e 's/17A5241l/17A5241n/g' /tmp/MyMetalExport/MetalToolchain-17A5241l.exportedBundle/ExportMetadata.plist

xcodebuild -importComponent metalToolchain -importPath /tmp/MyMetalExport/MetalToolchain-17A5241l.exportedBundle

I'm trying to build with fastlane and none of the shell snippets here are helping with that :\ .

Also Xcode cloud can't build either.

Tried more things. I observe that xcodebuild is still attempting to execute metal from here:

/Applications/Xcode-26.0.0-Beta.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal -c

This complains the toolchain does not exist. How can I point this to a different metal install?

Xcode shows that I have two metal toolchains installed. 17.0 (17A5241l) and 17.0 (17A5241n).

Xcode is able to build my code via the UI, but not via command line when executed by Fastlane.

Updated (Only for Xcode 26.0 beta 2)

  • Delete all Metal toolchains at Xcode Settings - Components. (If you scroll down at Components view, you can see additional Metal toolchains. Delete them if exists.)

  • Quit Xcode.

  • Run these commands

 
xcodebuild -deleteComponent metalToolchain
 
sudo rm -rf ~/Library/Developer/DVTDownloads/MetalToolchain/
 
sudo rm -rf ~/Library/Developer/DVTDownloads/Assets/MetalToolchain/
 
sudo rm -rf /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/
 
rm -rf /tmp/MyMetalExport/
 
xcodebuild -downloadComponent metalToolchain -exportPath /tmp/MyMetalExport/
 
sed -i '' -e 's/17A5241l/17A5241o/g' /tmp/MyMetalExport/MetalToolchain-17A5241l.exportedBundle/ExportMetadata.plist
 
xcodebuild -importComponent metalToolchain -importPath /tmp/MyMetalExport/MetalToolchain-17A5241l.exportedBundle
  • Reboot your Mac immediately.

  • Open Xcode and do not open Xcode Settings. Build your project immediately.

Updated for Xcode 26.0 beta 3 (17A5276g)

Navigate to this file: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*.asset/AssetData/Restore/*.dmg

and mount it.

I am still having this issue on Beta 3, after trying the methods mentioned above. It says:

cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain

Note: the metal command line code is run in my custom Swift Package plugin like this:


let xcRunURL = URL(fileURLWithPath: "/usr/bin/xcrun")

let p = Process()

p.executableURL = xcRunURL

p.arguments = [
    "metal",
     "-c",
    "-fcikernel",
    input,
     "-o",
    airOutput,
     "-fmodules=none"
]

Still happening in Xcode 26.0 (17A321) RC

I'm also having issues on Xcode 26 RC. I somehow managed to get it to compile, though unsure what or how, but after a reboot it went back to being broken.

I'm also unable to run sudo rm -rf /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/, it errors saying Operation not permitted. The folder contains two .asset folders if that's anything noteworthy.

Update: after many attempts I have gotten it to work by doing the following:

  • Disable system integrity protection (boot into recovery > terminal > csrutil disable)
  • Run sudo rm -rf /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/
  • Enable system integrity protection (boot into recovery > terminal > csrutil enable)
  • Install the toolchain
  • Manually mount the file at /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*.asset/AssetData/Restore/*.dmg

As soon as I mount it, it works. Unmounting it makes it not work again. If any engineers would want to look into why that's happening, I'd be happy to help them debug this.

I'd appreciate if folks experiencing this would open a bug report and post the FB number here, along with a sysdiagnose attached. The starting point for this thread was a known issue with Xcode 26 beta 1 which was resolved early on in the Xcode 26 beta cycle, so what you're encountering here is something else that we need to look into.

— Ed Ford,  DTS Engineer

I submitted the report, FB20260459

Same problem. Reported Sep, 9, still happens to me FB20178568

I can compile and run the project but I cannot use previews with Xcode 26.0.1. My projects needs to have "use legacy previews execution" switch enabled otherwise all previews are crashing during initialisation for same strange reason I have given up looking for a solution. With Xcode 26.0.1 the "automatic" build executed for legacy previews always fails with this error message so now I'm not able to use previews at all.

I still experience this problem with Xcode 26.1

~ ❯ xcodebuild -downloadComponent MetalToolchain
Beginning asset download...
2025-10-28 23:23:43.391 xcodebuild[1151:10353]  IDEDownloadableMetalToolchainCoordinator: Failed to remount the Metal Toolchain: The file “com.apple.MobileAsset.MetalToolchain-v17.1.324.0.wLDum9” couldn’t be opened because you don’t have permission to view it.
Downloaded asset to: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/4ab058bc1c53034b8c0a9baca6fba2d2b78bb965.asset/AssetData/Restore/022-17211-415.dmg
Done downloading: Metal Toolchain 17A324.

I encountered the same problem even I used the Xcode26 Xcode26.0.1 Xcode26.1(https://developer.apple.com/forums/thread/805547)

after two days try I fixed this problem by followed the methods in this article(https://medium.com/@sergey-pekar/how-to-fix-annoying-xcode-26-not-building-swiftui-previews-error-cannot-execute-tool-metal-due-49564e20357c)

I think there is still has a bug for install Metal Toolchain at least for those migrated from Xcode26 Beta

Unable to compile Core Image filter on Xcode 26 due to missing Metal toolchain
 
 
Q