MacOS SDK, Xcode on Nix Darwin

Hello all,

I’m currently messing around with direnv and nix-direnv to build an hermetic and reproducible local devenv for the project I’m working on.

Said project is a monorepo that contains backend and mobile apps, and uses Bazel as its build system.

Prior to the migration attempt with direnv and nix-direnv, everything worked fine while doing bazel build //....

However, when I run that command I now run into this issue:

> bazel build //...
INFO: Analyzed 204 targets (0 packages loaded, 23190 targets configured).
INFO: Found 204 targets...
ERROR: /private/var/tmp/_bazel_ar3s3ru/3efe07ce4123e4dfef2f8db5ddd896ff/external/protobuf~21.7/BUILD.bazel:457:10: Compiling src/google/protobuf/compiler/main.cc [for tool] failed: I/O exception during sandboxed execution: xcrun failed with code 1.
This most likely indicates that SDK version [10.10] for platform [MacOSX] is unsupported for the target version of xcode.
Process exited with status 1
stdout: stderr: 2023-08-23 17:06:55.097 xcodebuild[4278:33483] Writing error result bundle to /var/folders/dg/jf2qkwmn0qg4qklxq9c84j0w0000gn/T/ResultBundle_2023-23-08_17-06-0055.xcresult
xcodebuild: error: SDK "macosx10.10" cannot be located.
2023-08-23 17:06:56.448 xcodebuild[4279:33499] Writing error result bundle to /var/folders/dg/jf2qkwmn0qg4qklxq9c84j0w0000gn/T/ResultBundle_2023-23-08_17-06-0056.xcresult
xcodebuild: error: SDK "macosx10.10" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.10'
INFO: Elapsed time: 4.235s, Critical Path: 2.76s
INFO: 10 processes: 10 internal.
FAILED: Build did NOT complete successfully

It seems that the macosx SDK is missing. I was hoping that installing Xcode through direnv would solve the issue, but it didn’t…

Here is my direnv shell for context:

{ pkgs }:
let
  os =
    if pkgs.stdenv.hostPlatform.isLinux then
      "linux"
    else if pkgs.stdenv.hostPlatform.isDarwin then
      "darwin"
    else
      throw "unsupported os";

  platformPackages = with pkgs; {
    darwin = [
      darwin.xcode_14_1

      # For iOS development.
      ruby
      cocoapods
    ];
  }.${os} or [ ];
in
pkgs.mkShell {
  name = "local";

  packages = with pkgs; platformPackages ++ [
    aspect-cli # This brings in Bazel!
    git
    bazel-buildtools
    buf
    nodejs
    nodejs.pkgs.pnpm

    # Nix
    nix
    rnix-lsp

    # For backend development.
    google-cloud-sdk
    skaffold
    k3d
    kubectl
    kubernetes-helm

    # Go stuff.
    go_1_21
    gopls
    gotools
    go-outline
    gopkgs
    delve
    golangci-lint
  ];
}

Any ideas how can I download the macos SDK? I can’t find it through the NixOS search function on nixpkgs, but it’s here: https://github.com/NixOS/nixpkgs/blob/aebb382f2c1278af6cb23789ed845ec1ff1a87f0/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix

You include Xcode 14.1 in your derivation. If your build is using that, it should be using the SDK bundled with Xcode, which would be the 13.3 SDK for Xcode 14.1.

What does xcodebuild -showsdks print? That should list all of the SDKs it knows about if things are configured correctly.

This is what I’m getting:

> xcodebuild -showsdks
macosx SDKs:
        MacOSX11.0                      -sdk MacOSX11.0
        MacOSX11.0                      -sdk MacOSX11.0

I tried --macos_sdk_version flag for Bazel, but it seems it’s not working:

> bazel build //... --macos_sdk_version=11.0
INFO: Build option --macos_sdk_version has changed, discarding analysis cache.
INFO: Analyzed 204 targets (0 packages loaded, 23190 targets configured).
INFO: Found 204 targets...
ERROR: /private/var/tmp/_bazel_ar3s3ru/3efe07ce4123e4dfef2f8db5ddd896ff/external/protobuf~21.7/BUILD.bazel:457:10: Compiling src/google/protobuf/compiler/main.cc [for tool] failed: I/O exception during sandboxed execution: xcrun failed with code 1.
This most likely indicates that SDK version [11.0] for platform [MacOSX] is unsupported for the target version of xcode.
Process exited with status 1
stdout: stderr: 2023-08-23 21:23:40.943 xcodebuild[5711:46007] Writing error result bundle to /var/folders/dg/jf2qkwmn0qg4qklxq9c84j0w0000gn/T/ResultBundle_2023-23-08_21-23-0040.xcresult
xcodebuild: error: SDK "macosx11.0" cannot be located.
2023-08-23 21:23:42.307 xcodebuild[5714:46030] Writing error result bundle to /var/folders/dg/jf2qkwmn0qg4qklxq9c84j0w0000gn/T/ResultBundle_2023-23-08_21-23-0042.xcresult
xcodebuild: error: SDK "macosx11.0" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx11.0'
INFO: Elapsed time: 4.796s, Critical Path: 3.31s
INFO: 10 processes: 10 internal.
FAILED: Build did NOT complete successfully

Could it be due to naming?

Well well, I just found this Github comment mentioning this command:

> xcrun --show-sdk-path -sdk macosx
/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk

So it seems like the SDK version is actually 13.0.

I updated the bazel build command with this new version and this is what it outputs:

> bazel build --verbose_failures //... --macos_sdk_version=13.0
INFO: Build option --macos_sdk_version has changed, discarding analysis cache.
INFO: Analyzed 204 targets (0 packages loaded, 23190 targets configured).
INFO: Found 204 targets...
ERROR: /private/var/tmp/_bazel_ar3s3ru/3efe07ce4123e4dfef2f8db5ddd896ff/external/zlib~1.2.13/BUILD.bazel:5:11: Compiling gzclose.c [for tool] failed: undeclared inclusion(s) in rule '@zlib~1.2.13//:zlib':
this rule is missing dependency declarations for the following files included by 'gzclose.c':
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_stdio.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_symbol_aliasing.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_posix_availability.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/Availability.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/AvailabilityVersions.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/AvailabilityInternal.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_types.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/machine/_types.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/arm/_types.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_types.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_va_list.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/machine/types.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/arm/types.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_int8_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_int16_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_int32_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_int64_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_u_int8_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_u_int16_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_u_int32_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_u_int64_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_intptr_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_uintptr_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_size_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_null.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/stdio.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_ctermid.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_off_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_ssize_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/secure/_stdio.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/secure/_common.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/stddef.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/__stddef_max_align_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/limits.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/limits.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/machine/limits.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/arm/limits.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/arm/_limits.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/syslimits.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/types.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/appleapiopts.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/machine/endian.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/arm/endian.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_endian.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/libkern/_OSByteOrder.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/libkern/arm/OSByteOrder.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/stdint.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdint.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_types/_uint8_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_types/_uint16_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_types/_uint32_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_types/_uint64_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_types/_intmax_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_types/_uintmax_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/arm/arch.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_u_char.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_u_short.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_u_int.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_caddr_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_dev_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_blkcnt_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_blksize_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_gid_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_in_addr_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_in_port_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_ino_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_ino64_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_key_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_mode_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_nlink_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_id_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_pid_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_uid_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_clock_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_time_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_useconds_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_suseconds_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_rsize_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_errno_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_fd_def.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_fd_setsize.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_fd_set.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_fd_clr.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_fd_zero.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_fd_isset.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_fd_copy.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_attr_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_cond_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_condattr_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_mutex_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_mutexattr_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_once_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_rwlock_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_rwlockattr_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_pthread/_pthread_key_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_fsblkcnt_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_fsfilcnt_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/stdarg.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/unistd.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/unistd.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_posix_vdisable.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_seek_set.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/select.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_timespec.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_timeval.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_sigset_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_select.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_uuid_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/gethostuuid.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/string.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/strings.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/secure/_strings.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/secure/_string.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdlib.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/wait.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/signal.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/machine/signal.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/arm/signal.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/machine/_mcontext.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/arm/_mcontext.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/mach/machine/_structs.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/mach/arm/_structs.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_sigaltstack.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_ucontext.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/resource.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/alloca.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_ct_rune_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_rune_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_wchar_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/malloc/_malloc.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/fcntl.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/fcntl.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_o_sync.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_o_dsync.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_s_ifmt.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/_types/_filesec_t.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/errno.h'
  '/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/errno.h'
INFO: Elapsed time: 2.546s, Critical Path: 1.06s
INFO: 11 processes: 11 internal.
FAILED: Build did NOT complete successfully

I guess this means there are some headers missing in the SDK path? Does that make sense @reckenrode based on what gets installed by darwin.xcode on the Nix store?

I’m not very familiar with Bazel, but searching online suggests doing bazel clean --expunge after making a change to your settings. It’s not that it’s failing to find those paths but that it’s finding them when it doesn’t expect them.

2 Likes

Nevermind, I found out that it was due to the cached files that Bazel created when I was using the binary outside the devshell. Apparently it didn’t like that.

After doing bazel clean --expunge and using bazel build --macos_sdk_version=13.0 it works :raised_hands:

1 Like

Since I have you here already @reckenrode, is there any way I can install the Xcode Command Line Tools through the devshell? Trying to run expo start --ios and it keeps on asking me this.

Also, it seems like the output of xcode-select --print-path changes between inside the devshell and outside of it:

# Inside the devshell
> xcode-select --print-path
/nix/store/1qxhik4b13h0h3xaim8aji98skyh558r-xcodebuild-0.1.2-pre/Applications/Xcode.app/Contents/Developer

# Outside the devshell
> xcode-select --print-path
/nix/store/bycxrcr3mjjfl5565dnv5qqhvyrffr5s-Xcode.app/Contents/Developer

I’ve followed these instructions to make Xcode available in the Nix store: https://github.com/NixOS/nixpkgs/blob/032324fd20e3be4124ffefd00da5bd66b0550e8c/pkgs/os-specific/darwin/xcode/default.nix#L23-L32

The command-line tools aren’t packaged, so not as far as I’m aware.

The first one is coming from xcbuild, which is propagated by Go. The second one is using the system xcode-select, which appears to be configured with the Xcode in your devshell.

2 Likes