Xcode 14.3构建synctex项目报错:本地路径为(null)不存在
问题描述
我正在Xcode 14.3中构建synctex项目,遵循官方文档,但构建时Xcode报错:
The local path is “(null)” and it doesn't exist. Check that the project is building the executably correctly
完整输出信息:
Details An executable path doesn't exist. Domain: IDEDebugSessionErrorDomain Code: 3 Failure Reason: The local path is “(null)” and it doesn't exist. Check that the project is building the executably correctly. User Info: { DVTErrorCreationDateKey = "2023-09-30 06:07:05 +0000"; DVTRadarComponentKey = 343469; IDERunOperationFailingWorker = DBGLLDBLauncher; } -- Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : { "device_model" = "MacBookPro18,1"; "device_osBuild" = "13.3.1 (22E261)"; "device_platform" = "com.apple.platform.macosx"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 6; "operation_errorCode" = 3; "operation_errorDomain" = IDEDebugSessionErrorDomain; "operation_errorWorker" = DBGLLDBLauncher; "operation_name" = IDERunOperationWorkerGroup; "param_consoleMode" = 0; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 3; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.macosx"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 0; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 0; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 0; "param_launcher_substyle" = 0; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.tool"; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "macosx13.3"; "sdk_osVersion" = "13.3"; "sdk_variant" = macos; } -- System Information macOS Version 13.3.1 (a) (Build 22E772610a) Xcode 14.3 (21812) (Build 14E222b) Timestamp: 2023-09-30T14:07:05+08:00
找不到在Xcode中设置本地路径的地方,请问该如何解决此问题?
解决方案
这个报错的核心原因是Xcode的运行Scheme未正确关联可执行产物,或者构建产物路径配置异常,导致调试器找不到要启动的可执行文件。按以下步骤排查:
1. 检查Scheme的可执行文件关联
- 点击Xcode顶部工具栏的Scheme下拉菜单,选择
Edit Scheme... - 在弹出窗口左侧选择
Run,切换到Info标签页 - 确认
Executable下拉框已选中synctex对应的可执行目标(产物类型为com.apple.product-type.tool,与报错信息中的参数一致) - 若下拉框为空或无有效选项,点击下拉框选择
Other...,手动定位到项目构建后的可执行文件(默认路径为DerivedData/[项目名]/Build/Products/Debug/[synctex可执行文件名])
2. 验证目标构建设置
- 在项目导航栏选中synctex目标,打开
Build Settings标签页 - 搜索
Product Name,确认名称无误;搜索Executable Path,确保值为默认的$(EXECUTABLE_NAME),无需手动修改 - 检查
Build Products Path,确认路径为$(BUILD_DIR),保证产物输出路径有效
3. 清理并重新构建
- 执行
Product > Clean Build Folder(快捷键Cmd+Shift+K),清除旧的构建缓存 - 执行
Product > Build(快捷键Cmd+B),等待构建完成后再尝试运行
4. 重置DerivedData目录
- 打开Xcode的
Preferences > Locations,找到Derived Data的路径 - 手动删除该路径下对应项目的文件夹,然后重新构建项目
内容的提问来源于stack exchange,提问作者Dolphin
相关产品推荐
相关产品推荐

