I ran into an error in my Flutter project after updating to Xcode 14.3 from 13.x. Specifically, the error was related to 'nanopb' from the 'Pods':

... DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
...
[        ] ** BUILD FAILED **
[        ] The following build commands failed:
[        ] 	Ld /Users/user/project/build/macos/Build/Products/Debug/nanopb/nanopb.framework/Versions/A/nanopb normal (in target 'nanopb' from project 'Pods')
[        ] (1 failure)
[+6803 ms] Exception: Build process failed
Exited (sigterm)
[   +5 ms] 
#0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:571:9)
           <asynchronous suspension>
#2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
           <asynchronous suspension>
#3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
#4      CommandRunner.runCommand
command_runner.dart:209
           <asynchronous suspension>
#5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
           <asynchronous suspension>
#6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
#7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
           <asynchronous suspension>
#8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
#9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
#10     main (package:flutter_tools/executable.dart:92:3)

I spent about four hours fixing it, and the only thing that helped was using Xcode version 14.2 instead of 14.3. Here are the steps to install the older version of Xcode with the older Command Line Tools and have two versions of Xcode:

How to use an older version of Xcode (Command Line tools)

  • Go to the Apple Developer Download page.
  • Look for Xcode 14.2 and download it.
  • Extract the downloaded file and rename it to "Xcode 14.2" or any other name except for "Xcode."
  • Copy it to the Applications folder. Now, in the Applications folder, you should see two versions: "Xcode" and "Xcode 14.2."
  • Open “Xcode”→”Settings”→”Locations”→"Command Line Tools”.
  • You should see at least two options. Choose the "Xcode 14.2" option.
Xcode settings - Command Line Tools

Switching between versions of Command Line Tools

To switch between versions of Command Line Tools:

  • Open “Xcode”→”Settings”→”Locations”→"Command Line Tools”.
  • Select the version you need.

You can also use the following command to switch between the two versions of Command Line Tools:

sudo xcode-select -s "/Applications/Xcode 14.2.app/Contents/Developer"

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Check which Command Line Tool version you're using

To check which Xcode and Command Line Tool version you're using, you can run the following command:

clang --version

This will return a result like this:

Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Applications/Xcode 14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Alternatively, you can use the command:

xcodebuild -version

This will return:

Xcode 14.2
Build version 14C18