MCPcopy Create free account
hub / github.com/Snapchat/Valdi / checkXcodeInstallation

Method checkXcodeInstallation

npm_modules/cli/src/commands/doctor.ts:652–718  ·  view source on GitHub ↗

* Validates comprehensive Xcode installation and configuration. * * Performs thorough checks matching dev_setup requirements: * - xcode-select command exists * - xcode-select path is configured and valid * - /Applications/Xcode.app exists * * @returns Promise that resolves when

()

Source from the content-addressed store, hash-verified

650 // Check if xcode-select command exists
651 if (!checkCommandExists('xcode-select')) {
652 this.addResult({
653 name: 'Xcode',
654 status: 'fail',
655 message: 'Xcode command line tools not installed',
656 details: 'Required for iOS app development',
657 fixable: true,
658 fixCommand: 'Install Xcode from App Store (https://apps.apple.com/us/app/xcode/id497799835)',
659 category: 'iOS development',
660 });
661 return;
662 }
663
664 // Check if Xcode is properly configured
665 try {
666 const { stdout } = await runCliCommand('xcode-select -p');
667 const xcodePath = stdout.trim();
668
669 if (!xcodePath || !fs.existsSync(xcodePath)) {
670 this.addResult({
671 name: 'Xcode configuration',
672 status: 'fail',
673 message: 'Xcode command line tools path is not configured correctly',
674 fixable: true,
675 fixCommand: 'Run: sudo xcode-select -s /Applications/Xcode.app (or your Xcode path)',
676 category: 'iOS development',
677 });
678 return;
679 }
680
681 // Extract Xcode.app path from the Developer path
682 // xcode-select -p typically returns: /Applications/Xcode.app/Contents/Developer
683 const xcodeAppPath = xcodePath.replace(/\/Contents\/Developer\/?$/, '');
684
685 if (fs.existsSync(xcodeAppPath) && xcodeAppPath.includes('Xcode')) {
686 // Xcode is installed and configured
687 this.addResult({
688 name: 'Xcode',
689 status: 'pass',
690 message: `Xcode found at ${xcodeAppPath}`,
691 category: 'iOS development',
692 });
693 } else {
694 // Path doesn't point to an Xcode installation
695 this.addResult({
696 name: 'Xcode',
697 status: 'fail',
698 message: 'Xcode installation not found',
699 details: `xcode-select points to ${xcodePath}, but Xcode app not found at ${xcodeAppPath}`,
700 fixable: true,
701 fixCommand: 'Install Xcode from App Store (https://apps.apple.com/us/app/xcode/id497799835)',
702 category: 'iOS development',
703 });
704 }
705 } catch {
706 this.addResult({
707 name: 'Xcode',
708 status: 'fail',
709 message: 'Xcode not properly configured',

Callers 1

Calls 5

addResultMethod · 0.95
checkCommandExistsFunction · 0.90
runCliCommandFunction · 0.90
replaceMethod · 0.65
trimMethod · 0.45

Tested by

no test coverage detected