build_mac_proj
Automate macOS app builds by specifying project paths, schemes, and configurations using xcodebuild. Supports custom architectures, derived data paths, and additional arguments for tailored builds.
Instructions
Builds a macOS app using xcodebuild from a project file.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arch | No | Architecture to build for (arm64 or x86_64). For macOS only. | |
| configuration | No | Build configuration (Debug, Release, etc.) | |
| derivedDataPath | No | Path where build products and other derived data will go | |
| extraArgs | No | Additional xcodebuild arguments | |
| preferXcodebuild | No | If true, prefers xcodebuild over the experimental incremental build system, useful for when incremental build system fails. | |
| projectPath | Yes | Path to the .xcodeproj file (Required) | |
| scheme | Yes | The scheme to use (Required) |
Implementation Reference
- src/tools/build_macos.ts:47-71 (handler)Core implementation of the build logic for the 'build_mac_proj' tool. This private function handles the execution of the xcodebuild command for macOS projects.async function _handleMacOSBuildLogic(params: { workspacePath?: string; projectPath?: string; scheme: string; configuration: string; derivedDataPath?: string; arch?: string; extraArgs?: string[]; preferXcodebuild?: boolean; }): Promise<ToolResponse> { log('info', `Starting macOS build for scheme ${params.scheme} (internal)`); return executeXcodeBuildCommand( { ...params, }, { platform: XcodePlatform.macOS, arch: params.arch, logPrefix: 'macOS Build', }, params.preferXcodebuild, 'build', ); }
- src/tools/build_macos.ts:270-278 (schema)Input schema definition for the 'build_mac_proj' tool, including project-specific parameters like projectPath and optional arch.{ projectPath: projectPathSchema, scheme: schemeSchema, configuration: configurationSchema, derivedDataPath: derivedDataPathSchema, arch: archSchema, extraArgs: extraArgsSchema, preferXcodebuild: preferXcodebuildSchema, },
- src/tools/build_macos.ts:255-286 (registration)Local registration function for the 'build_mac_proj' tool, defining name, description, schema, and handler.export function registerMacOSBuildProjectTool(server: McpServer): void { type ProjectParams = { projectPath: string; scheme: string; configuration?: string; derivedDataPath?: string; arch?: string; extraArgs?: string[]; preferXcodebuild?: boolean; }; registerTool<ProjectParams>( server, 'build_mac_proj', 'Builds a macOS app using xcodebuild from a project file.', { projectPath: projectPathSchema, scheme: schemeSchema, configuration: configurationSchema, derivedDataPath: derivedDataPathSchema, arch: archSchema, extraArgs: extraArgsSchema, preferXcodebuild: preferXcodebuildSchema, }, async (params) => _handleMacOSBuildLogic({ ...params, configuration: params.configuration ?? 'Debug', preferXcodebuild: params.preferXcodebuild ?? false, }), ); }
- src/utils/register-tools.ts:199-202 (registration)Invocation of the tool registration in the central registerTools function, grouped under MACOS_WORKFLOW.{ register: registerMacOSBuildProjectTool, groups: [ToolGroup.MACOS_WORKFLOW], envVar: 'XCODEBUILDMCP_TOOL_MACOS_BUILD_PROJECT',
- src/tools/build_macos.ts:37-40 (helper)macOS-specific architecture schema used in the tool's input validation.const archSchema = z .enum(['arm64', 'x86_64']) .optional() .describe('Architecture to build for (arm64 or x86_64). For macOS only.');