{"record":{"id":"075945053e6414da","repo":"ruvnet/RuView","slug":"swiftc-is-not-installed-please-install-xcode-comm","errorCode":null,"errorMessage":"swiftc is not installed. Please install Xcode Command Line Tools to use native macOS WiFi sensing.","messagePattern":"swiftc is not installed\\. Please install Xcode Command Line Tools to use native macOS WiFi sensing\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"archive/v1/src/sensing/rssi_collector.py","lineNumber":678,"sourceCode":"\n    @property\n    def sample_rate_hz(self) -> float:\n        return self._rate\n\n    def start(self) -> None:\n        if self._running:\n            return\n        \n        # Ensure binary exists\n        import os\n        if not os.path.exists(self.swift_bin):\n            logger.info(\"Compiling mac_wifi.swift to %s\", self.swift_bin)\n            try:\n                subprocess.run([\"swiftc\", \"-O\", \"-o\", self.swift_bin, self.swift_src], check=True, capture_output=True)\n            except subprocess.CalledProcessError as e:\n                raise RuntimeError(f\"Failed to compile macOS WiFi utility: {e.stderr.decode('utf-8')}\")\n            except FileNotFoundError:\n                raise RuntimeError(\"swiftc is not installed. Please install Xcode Command Line Tools to use native macOS WiFi sensing.\")\n\n        self._running = True\n        self._thread = threading.Thread(\n            target=self._sample_loop, daemon=True, name=\"mac-rssi-collector\"\n        )\n        self._thread.start()\n        logger.info(\"MacosWifiCollector started at %.1f Hz\", self._rate)\n\n    def stop(self) -> None:\n        self._running = False\n        if self._process:\n            self._process.terminate()\n            try:\n                self._process.wait(timeout=1.0)\n            except subprocess.TimeoutExpired:\n                self._process.kill()\n            self._process = None\n","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/sensing/rssi_collector.py#L660-L696","documentation":"MacosWifiCollector.start() tried to run swiftc and the OS returned FileNotFoundError: the Swift compiler is not on PATH. On macOS, swiftc comes from the Xcode Command Line Tools (or full Xcode), so this machine simply lacks the toolchain. Unlike a compile failure, nothing was attempted yet; installing the tools fixes it.","triggerScenarios":"First run of MacosWifiCollector on a fresh Mac without Xcode Command Line Tools; Xcode/CLT uninstalled or its path stripped from PATH; xcode-select points at a deleted developer directory.","commonSituations":"New Macs or freshly wiped machines; CI macOS images where CLT installation was skipped; users who removed Xcode; xcode-select pointing to '/Library/Developer/CommandLineTools' that no longer exists.","solutions":["Install the toolchain: 'xcode-select --install' and complete the GUI prompt.","Verify afterwards: 'xcode-select -p' prints a valid path and 'which swiftc' resolves.","Accept the license if needed: 'sudo xcodebuild -license accept'.","If xcode-select points at a stale directory, run 'sudo xcode-select --reset' or point it at the installed Xcode."],"exampleFix":"# before\ncollector = MacosWifiCollector(rate=2.0)\ncollector.start()  # RuntimeError: swiftc is not installed\n\n# after\nimport shutil\nif shutil.which('swiftc') is None:\n    raise SystemExit('Run: xcode-select --install, then retry')\ncollector = MacosWifiCollector(rate=2.0)\ncollector.start()","handlingStrategy":"validation","validationCode":"import shutil\nif shutil.which('swiftc') is None:\n    raise SystemExit('swiftc missing; run: xcode-select --install')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check shutil.which('swiftc') in macOS deployment preflight before enabling the RSSI collector.","Automate 'xcode-select --install' (or bake CLT into CI images) so fresh Macs are provisioning-complete.","After installing tools, verify with 'xcode-select -p' and 'swiftc --version' before first run."],"tags":["macos","xcode","swiftc","toolchain","setup"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}