Opened 5 months ago

Last modified 2 weeks ago

#73180 reopened request

Retry macOS 26 builds on buildbot with Xcode 26 Metal toolchain fix in place

Reported by: markmentovai (Mark Mentovai) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: breun (Nils Breunese), reneeotten (Renee Otten), jmroot (Joshua Root), Dave-Allured (Dave Allured), axonde (Axonde ✦)
Port: qt6-qtwebengine, openjdk17, openjdk21, openjdk25

Description

MacPorts 2.11.6 contains 4497293e70b1, the fix for #73160, which should make it significantly easier to build ports that depend on the Metal toolchain using Xcode 26.

It would be good to get the ports known to be affected by this problem built on the buildbot.

On the buildbot, assuming it’s updated to MacPorts 2.11.6, run:

% xcodebuild -downloadComponent MetalToolchain

While still using Xcode 26.0 or 26.0.1, additionally run:

% sudo --user=macports xcodebuild -showComponent MetalToolchain
% sudo rm -f "$(sudo --user=macports getconf DARWIN_USER_TEMP_DIR)/xcrun_db"

Then re-attempt builds for the following ports—links are to previous failing builds:

Change History (22)

comment:2 Changed 4 months ago by jmroot (Joshua Root)

Resolution: fixed
Status: assignedclosed

All builds were successful.

comment:3 Changed 6 weeks ago by breun (Nils Breunese)

Resolution: fixed
Status: closedreopened

I pushed updates for openjdk21 21.0.10 and openjdk25 25.0.2 this month, which succeeded for me locally after installing the Metal toolchain, but these builds are failing on the macOS 26 buildbots, so it seems this issue is back.

openjdk21: https://build.macports.org/builders/ports-26_arm64-builder/builds/25096

checking for metal... [not found]
checking if metal can be run using xcrun... no
configure: error: XCode tool 'metal' neither found in path nor with xcrun
configure exiting with result code 1

openjdk25: https://build.macports.org/builders/ports-26_arm64-builder/builds/25097

checking for metal... [not found]
checking if metal can be run using xcrun... no
configure: A full XCode is required to build the JDK (not only command line tools)
configure: If you have XCode installed, you might need to reset the Xcode active developer directory
configure: using 'sudo xcode-select -r'
configure: error: XCode tool 'metal' neither found in path nor with xcrun
configure exiting with result code 1

So, it seems like the Metal toolchain on the buildbots is no longer getting found, while it was found before and it is found for me locally on macOS 26.2 with Xcode 26.2 with the Metal toolchain set up according to the instructions at TahoeProblems#MetaltoolchainisnolongerbundledinXcode.

I'm holding off on pushing updates for other OpenJDK versions for now, because I expect those builds will also fail to access the Metal toolchain on the buildbots.

Last edited 6 weeks ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:4 Changed 6 weeks ago by markmentovai (Mark Mentovai)

On the bot, try removing the xcrun cache:

% sudo rm -f "$(sudo --user=macports getconf DARWIN_USER_TEMP_DIR)/xcrun_db"

and then retrying the build.

comment:5 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)

I already did that, since it's in the aforementioned instructions.

comment:6 Changed 6 weeks ago by markmentovai (Mark Mentovai)

Can you show the output of these commands on that bot, running as the macports user?

xcodebuild -showComponent MetalToolchain
xcodebuild -find metal
xcrun_verbose=1 xcrun --find metal
xcrun_verbose=1 xcrun --sdk macosx --find metal
xcrun_verbose=1 xcrun --sdk macosx26.2 --find metal
xcrun metal --version
xcrun --sdk macosx metal --version
xcrun --sdk macosx26.2 metal --version
mount | grep MetalToolchain
ls -ldfT / /private /private/var /private/var/run /private/var/run/com.apple.security.cryptexd /private/var/run/com.apple.security.cryptexd/mnt /private/var/run/com.apple.security.cryptexd/mnt
ls -lT /private/var/run/com.apple.security.cryptexd/mnt

That should help figure out which step the problem is creeping in at.

(Yeah, it’s a lot, but I’m hoping to reduce the number of turnarounds.)

comment:7 in reply to:  6 Changed 5 weeks ago by breun (Nils Breunese)

Ryan, could you run the commands Mark posted on the macOS 26 arm64 buildbot? Hopefully this lets us spot what is causing the Metal toolchain to not get found, which is causing OpenJDK builds to fail on macOS 26.

comment:8 in reply to:  6 Changed 5 weeks ago by ryandesign (Ryan Carsten Schmidt)

Replying to markmentovai:

Can you show the output of these commands on that bot, running as the macports user?

% sudo -u macports -s
Password:
%
% whoami
macports
%
% xcodebuild -showComponent MetalToolchain
Asset Path: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/0bc538ab0cfa107625f77ad7bcfa566abe43e917.asset/AssetData
Build Version: 17C48
Status: installed
Toolchain Identifier: com.apple.dt.toolchain.Metal.32023
Toolchain Search Path: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw
%
% xcodebuild -find metal
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal
%
% xcrun_verbose=1 xcrun --find metal
xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk|/Applications/Xcode.app/Contents/Developer|<manpath>
xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:'
xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin'
xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db'
xcrun: note: xcrun via metal (xcrun)
xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk||/Applications/Xcode.app/Contents/Developer|
xcrun: note: looking up with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find metal 2> /dev/null'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
xcrun: note: lookup resolved with 'xcodebuild -find' to '/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal'
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal
%
% xcrun_verbose=1 xcrun --sdk macosx --find metal
xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk|/Applications/Xcode.app/Contents/Developer|<manpath>
xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:'
xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin'
xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db'
xcrun: note: xcrun via metal (xcrun)
xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk||/Applications/Xcode.app/Contents/Developer|
xcrun: note: looking up with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk -find metal 2> /dev/null'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
xcrun: note: lookup resolved with 'xcodebuild -find' to '/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal'
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal
%
% xcrun_verbose=1 xcrun --sdk macosx26.2 --find metal
xcrun: note: looking up SDK with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx26.2 -version Path'
xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin'
xcrun: note: SDKROOT = 'macosx26.2'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
xcrun: note: lookup resolved to: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk'
xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk|/Applications/Xcode.app/Contents/Developer|<manpath>
xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:'
xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin'
xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db'
xcrun: note: xcrun via metal (xcrun)
xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk||/Applications/Xcode.app/Contents/Developer|
xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal'
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal
%
% xcrun metal --version
Apple metal version 32023.850 (metalfe-32023.850.10)
Target: air64-apple-darwin25.2.0
Thread model: posix
InstalledDir: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/metal/current/bin
%
% xcrun --sdk macosx metal --version
Apple metal version 32023.850 (metalfe-32023.850.10)
Target: air64-apple-darwin25.2.0
Thread model: posix
InstalledDir: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/metal/current/bin
%
% xcrun --sdk macosx26.2 metal --version
Apple metal version 32023.850 (metalfe-32023.850.10)
Target: air64-apple-darwin25.2.0
Thread model: posix
InstalledDir: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/metal/current/bin
%
% mount | grep MetalToolchain
/dev/disk7s1 on /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw (apfs, sealed, local, read-only, journaled, nobrowse)
%
% ls -ldfT / /private /private/var /private/var/run /private/var/run/com.apple.security.cryptexd /private/var/run/com.apple.security.cryptexd/mnt /private/var/run/com.apple.security.cryptexd/mnt
drwxr-xr-x  22 root  wheel    704 Nov 22 13:49:28 2025 /
drwxr-xr-x   6 root  wheel    192 Feb  9 19:31:10 2026 /private
drwxr-xr-x  35 root  wheel   1120 Jan 19 14:57:04 2026 /private/var
drwxrwxr-x  32 root  daemon  1024 Feb  9 19:46:12 2026 /private/var/run
drwx---r-x   8 root  daemon   256 Feb  9 19:31:22 2026 /private/var/run/com.apple.security.cryptexd
drwxr-xr-x   3 root  daemon    96 Feb  9 19:47:40 2026 /private/var/run/com.apple.security.cryptexd/mnt
drwxr-xr-x   3 root  daemon    96 Feb  9 19:47:40 2026 /private/var/run/com.apple.security.cryptexd/mnt
%
% ls -lT /private/var/run/com.apple.security.cryptexd/mnt
total 0
drwxr-xr-x  4 root  wheel  128 Nov 12 23:56:17 2025 com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw
%

comment:9 Changed 4 weeks ago by breun (Nils Breunese)

Any idea what's wrong here, Mark?

comment:10 Changed 4 weeks ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added

comment:11 in reply to:  9 ; Changed 4 weeks ago by markmentovai (Mark Mentovai)

Replying to breun:

Any idea what's wrong here, Mark?

Everything in comment 8 looks totally correct. I’d expect the build to succeed on that bot on the basis of what’s shown, assuming it’s running MacPorts 2.11.6 or later with the initgroups fix.

Can the build be retried? Then, only if it fails, we can repeat the investigation, in particular of the xcrun_verbose=1 xcrun --find commands?

Nils, note that the OpenJDK build has this quirk, where it finds metal by running xcrun -sdk macosx metal. The -sdk macosx circumvents the MacPorts-set SDKROOT, which may be undesirable, and results in xcrun using a different cache key than it would otherwise use. But JDK calling out -sdk macosx is why I asked for xcrun --sdk macosx --find metal above, and as you’ll see from Ryan’s response, xcrun was still able to resolve metal properly even with the SDK specified by that name. I don’t think that this is our problem, but you might still want to address it in the JDK ports regardless.

comment:12 in reply to:  11 Changed 4 weeks ago by ryandesign (Ryan Carsten Schmidt)

Replying to markmentovai:

Can the build be retried?

Sure; they'll show up at https://build.macports.org/builders/ports-26_arm64-watcher/builds/4679 tomorrow. (Until then, that URL will show "No such resource".)

comment:13 Changed 4 weeks ago by breun (Nils Breunese)

Failed again sadly.

openjdk21 ((https://build.macports.org/builders/ports-26_arm64-builder/builds/28552/steps/install-port/logs/stdio):

checking for metal... [not found]
checking if metal can be run using xcrun... no
configure: error: XCode tool 'metal' neither found in path nor with xcrun
configure exiting with result code 1

openjdk25 (https://build.macports.org/builders/ports-26_arm64-builder/builds/28553/steps/install-port/logs/stdio):

checking for metal... [not found]
checking if metal can be run using xcrun... no
configure: A full XCode is required to build the JDK (not only command line tools)
configure: If you have XCode installed, you might need to reset the Xcode active developer directory
configure: using 'sudo xcode-select -r'
configure: error: XCode tool 'metal' neither found in path nor with xcrun
configure exiting with result code 1

qt6-qtwebengine (https://build.macports.org/builders/ports-26_arm64-builder/builds/28554/steps/install-port/logs/stdio):

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

Ryan, could you repeat Mark's commands on the buildbot ("repeat the investigation, in particular of the xcrun_verbose=1 xcrun --find commands")?

Version 0, edited 4 weeks ago by breun (Nils Breunese) (next)

comment:14 Changed 3 weeks ago by breun (Nils Breunese)

Ryan, could you run the commands Mark posted on the macOS 26 arm64 buildbot once more to check if they still return the same output?

Last edited 3 weeks ago by breun (Nils Breunese) (previous) (diff)

comment:15 in reply to:  14 ; Changed 3 weeks ago by ryandesign (Ryan Carsten Schmidt)

Replying to breun:

Ryan, could you run the commands Mark posted on the macOS 26 arm64 buildbot once more to check if they still return the same output?

Hmm, it's different now.

% sudo -u macports -s
Password:
%
% whoami
macports
%
% xcodebuild -showComponent MetalToolchain
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
Build Version: 17C48
Status: uninstalled
%
% xcodebuild -find metal
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal
%
% xcrun_verbose=1 xcrun --find metal
xcrun: note: looking up SDK with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -version PlatformPath'
xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin'
xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
xcrun: note: lookup resolved to: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform'
xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk|/Applications/Xcode.app/Contents/Developer|<manpath>
xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin'
xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db'
xcrun: note: xcrun via metal (xcrun)
xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk||/Applications/Xcode.app/Contents/Developer|
xcrun: note: looking up with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find metal 2> /dev/null'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
xcrun: note: lookup resolved with 'xcodebuild -find' to '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal
%
% xcrun_verbose=1 xcrun --sdk macosx --find metal
xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk|/Applications/Xcode.app/Contents/Developer|<manpath>
xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:'
xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin'
xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db'
xcrun: note: xcrun via metal (xcrun)
xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk||/Applications/Xcode.app/Contents/Developer|
xcrun: note: looking up with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk -find metal 2> /dev/null'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
xcrun: note: lookup resolved with 'xcodebuild -find' to '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal
%
% xcrun_verbose=1 xcrun --sdk macosx26.2 --find metal
xcrun: note: looking up SDK with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx26.2 -version Path'
xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin'
xcrun: note: SDKROOT = 'macosx26.2'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
xcrun: note: lookup resolved to: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk'
xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk|/Applications/Xcode.app/Contents/Developer|<manpath>
xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:'
xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin'
xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk'
xcrun: note: TOOLCHAINS = ''
xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
xcrun: note: XCODE_DEVELOPER_USR_PATH = ''
xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db'
xcrun: note: xcrun via metal (xcrun)
xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk||/Applications/Xcode.app/Contents/Developer|
xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal
%
% xcrun metal --version
error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
%
% xcrun --sdk macosx metal --version
error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
%
% xcrun --sdk macosx26.2 metal --version
error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
%
% mount | grep MetalToolchain
%
% ls -ldfT / /private /private/var /private/var/run /private/var/run/com.apple.security.cryptexd /private/var/run/com.apple.security.cryptexd/mnt /private/var/run/com.apple.security.cryptexd/mnt
drwxr-xr-x  22 root  wheel    704 Feb  5 05:13:23 2026 /
drwxr-xr-x   6 root  wheel    192 Feb 23 04:52:06 2026 /private
drwxr-xr-x  35 root  wheel   1120 Feb 14 03:03:39 2026 /private/var
drwxrwxr-x  33 root  daemon  1056 Feb 23 05:02:54 2026 /private/var/run
drwx---r-x   8 root  daemon   256 Feb 23 04:52:11 2026 /private/var/run/com.apple.security.cryptexd
drwxr-xr-x   2 root  daemon    64 Feb 23 04:52:10 2026 /private/var/run/com.apple.security.cryptexd/mnt
drwxr-xr-x   2 root  daemon    64 Feb 23 04:52:10 2026 /private/var/run/com.apple.security.cryptexd/mnt
%
% ls -lT /private/var/run/com.apple.security.cryptexd/mnt
total 0
%

So the Metal toolchain has apparently uninstalled itself.

comment:16 in reply to:  15 ; Changed 3 weeks ago by markmentovai (Mark Mentovai)

Replying to ryandesign:

% ls -lT /private/var/run/com.apple.security.cryptexd/mnt
total 0
%

So the Metal toolchain has apparently uninstalled itself.

It’s not necessarily uninstalled, just not mounted. Usually cryptexd would mount it on demand as needed. It won’t appear mounted after a reboot. xcodebuild -showComponent MetalToolchain should have caused it to be mounted, though.

If installed, /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg should show it.

% ls -l /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg              
-rw-r--r--  1 _nsurlsessiond  wheel  717677052 Dec 15 09:45 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/0bc538ab0cfa107625f77ad7bcfa566abe43e917.asset/AssetData/Restore/022-20660-054.dmg
-rw-r--r--  1 _nsurlsessiond  wheel  715162684 Sep 25 23:33 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/4ab058bc1c53034b8c0a9baca6fba2d2b78bb965.asset/AssetData/Restore/022-17211-415.dmg
-rw-r--r--  1 _nsurlsessiond  wheel  716269972 Nov  3 20:06 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/68d8db6212b48d387d071ff7b905df796658e713.asset/AssetData/Restore/022-20369-066.dmg

022-20660-054.dmg is MetalToolchain 17C48. Does the bot have that?

The other thing I notice: the first difference between comment:8 and comment:15 is:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied

Does it help to cd to a “safe” (accessible to the macports user) directory immediately after sudo -u macports -s? (Perhaps this is a red herring, because the same error does appear later on in comment:8.)

Last edited 3 weeks ago by markmentovai (Mark Mentovai) (previous) (diff)

comment:17 in reply to:  16 Changed 3 weeks ago by ryandesign (Ryan Carsten Schmidt)

Replying to markmentovai:

It’s not necessarily uninstalled, just not mounted.

I assumed it has been uninstalled because...

Replying to ryandesign:

% xcodebuild -showComponent MetalToolchain
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
Build Version: 17C48
Status: uninstalled

...it says it is uninstalled.

If installed, /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg should show it.

% ls -l /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg              
-rw-r--r--  1 _nsurlsessiond  wheel  717677052 Dec 15 09:45 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/0bc538ab0cfa107625f77ad7bcfa566abe43e917.asset/AssetData/Restore/022-20660-054.dmg
-rw-r--r--  1 _nsurlsessiond  wheel  715162684 Sep 25 23:33 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/4ab058bc1c53034b8c0a9baca6fba2d2b78bb965.asset/AssetData/Restore/022-17211-415.dmg
-rw-r--r--  1 _nsurlsessiond  wheel  716269972 Nov  3 20:06 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/68d8db6212b48d387d071ff7b905df796658e713.asset/AssetData/Restore/022-20369-066.dmg

022-20660-054.dmg is MetalToolchain 17C48. Does the bot have that?

There's nothing there:

% ls -l /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg
zsh: no matches found: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg

The other thing I notice: the first difference between comment:8 and comment:15 is:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied

Does it help to cd to a “safe” (accessible to the macports user) directory immediately after sudo -u macports -s? (Perhaps this is a red herring, because the same error does appear later on in comment:8.)

It doesn't seem to make a difference.

comment:18 Changed 3 weeks ago by markmentovai (Mark Mentovai)

Replying to ryandesign:

So weird!

If you install it again, can you do anything to monitor how long it sticks around, so we can maybe work out what’s causing it to be uninstalled?

comment:19 Changed 3 weeks ago by axonde (Axonde ✦)

I'm experiencing a similar issue on my local machine (macOS 15.0, Xcode 16.0), Metal toolchain installed via MobileAsset, path:

/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-.../Metal.xctoolchain/usr/bin/metal

The configure script for openjdk25 fails with:

checking for metal... [not found]
checking if metal can be run using xcrun... no
configure: error: XCode tool 'metal' neither found in path nor with xcrun

However, xcrun itself locates the tool correctly:

% xcrun --sdk macosx --find metal
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.519.0.4VzvkH/Metal.xctoolchain/usr/bin/metal
% xcrun --sdk macosx metal --version
Apple metal version 32023.850 (metalfe-32023.850.10)
...

It seems that during configuration, the check for metal either doesn't use xcrun correctly or the xcrun cache is not properly updated for the specific SDK used by the configure script.

Workaround that worked for me:

I created a symbolic link to metal in a directory already present in PATH (specifically /opt/local/bin):

sudo ln -s /var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-*/Metal.xctoolchain/usr/bin/metal /opt/local/bin/metal

After that, the configure step succeeded and the port built without issues.

This suggests that adding the ability to respect a METAL environment variable (like for CC, CXX) or improving the xcrun invocation in the configure script might help. Alternatively, ensuring that the xcrun cache is refreshed or that the path is added to PATH during configuration could also resolve it.

Hope this additional data helps in fixing the issue for both buildbots and end users.

comment:20 in reply to:  19 Changed 3 weeks ago by breun (Nils Breunese)

Replying to axonde:

Workaround that worked for me

Did you try the workaround documented on the wiki first?

Last edited 2 weeks ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:21 in reply to:  19 ; Changed 2 weeks ago by ryandesign (Ryan Carsten Schmidt)

Cc: axonde added

Replying to axonde:

The configure script for openjdk25 fails with:

checking for metal... [not found]
checking if metal can be run using xcrun... no
configure: error: XCode tool 'metal' neither found in path nor with xcrun

What does the config.log say about why this failed?

See also the preceding comment from Nils.

comment:22 in reply to:  21 Changed 2 weeks ago by axonde (Axonde ✦)

Replying to breun and ryandesign:

Thanks for the pointers!

To answer your questions:

Did I try the wiki workaround first?

No, I didn't – I jumped straight to creating a symlink because xcrun already found the tool, and I assumed the configure script would respect that. I should have checked the wiki first.

What does config.log say?

I've now removed my symlink and followed the official workaround from TahoeProblems. After that, both openjdk21 and openjdk25 configured and built successfully without any errors. Since the build now works, the relevant config.log no longer shows the failure. If you'd like me to attach the original failing config.log (from before the fix) for reference, I can do that – just let me know.

So the wiki instructions are definitely correct and sufficient for a local setup like mine!

Last edited 2 weeks ago by axonde (Axonde ✦) (previous) (diff)
Note: See TracTickets for help on using tickets.