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
Unable to compile Core Image filter on Xcode 26 due to missing Metal toolchain
 
 
Q