{"record":{"id":"fa9dae45005ee23f","repo":"nikivdev/code","slug":"refusing-to-disable-apple-service-this-could","errorCode":null,"errorMessage":"Refusing to disable Apple service '{}'. This could break your system.","messagePattern":"Refusing to disable Apple service '(.+?)'\\. This could break your system\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/macos.rs","lineNumber":301,"sourceCode":"    // Show plist content\n    println!(\"\\nPlist contents:\");\n    if let Ok(content) = std::fs::read_to_string(&svc.plist_path) {\n        println!(\"{}\", content);\n    }\n\n    Ok(())\n}\n\nfn run_disable(opts: MacosDisableOpts) -> Result<()> {\n    let services = discover_services()?;\n\n    let svc = services\n        .iter()\n        .find(|s| s.id == opts.service)\n        .ok_or_else(|| anyhow::anyhow!(\"Service '{}' not found\", opts.service))?;\n\n    if svc.category == ServiceCategory::Apple {\n        bail!(\n            \"Refusing to disable Apple service '{}'. This could break your system.\",\n            svc.id\n        );\n    }\n\n    if !opts.yes {\n        print!(\"Disable service '{}'? [y/N] \", svc.id);\n        io::stdout().flush()?;\n\n        let mut input = String::new();\n        io::stdin().read_line(&mut input)?;\n        if !input.trim().eq_ignore_ascii_case(\"y\") {\n            println!(\"Cancelled.\");\n            return Ok(());\n        }\n    }\n\n    disable_service(svc)?;","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/macos.rs#L283-L319","documentation":"run_disable blocks disabling services in the Apple category as a safety guard, since disabling OS-provided launchd services can break macOS. The service id must exist (otherwise a separate 'Service not found' error fires); this error fires only for known Apple-owned services.","triggerScenarios":"Running the disable command for a service whose entry has category == ServiceCategory::Apple (e.g. system daemons like com.apple.* services), without any override.","commonSituations":"Trying to disable Spotlight, mDNSResponder or other Apple system agents to 'free resources'; accidentally passing an Apple service id in a cleanup script.","solutions":["Choose a non-Apple service to disable — Apple services are intentionally protected.","If you truly must change an Apple service, use launchctl directly at your own risk (`sudo launchctl bootout system/<service>`) rather than this tool.","Re-check the service id; you may have mistyped and matched an Apple service unintentionally."],"exampleFix":"// before\nflow macos disable com.apple.mDNSResponder\n// after\nflow macos disable com.example.my-daemon","handlingStrategy":"validation","validationCode":"// check category before invoking disable\nlet svc = list_services()?.into_iter().find(|s| s.id == \"com.apple.mDNSResponder\");\nif let Some(s) = svc {\n    if s.category == \"apple\" {\n        eprintln!(\"refusing to disable Apple service\");\n        return;\n    }\n}","typeGuard":"fn is_disallowable(svc: &Service) -> bool {\n    svc.category == ServiceCategory::Apple\n}","tryCatchPattern":"match macos::run_disable(opts) {\n    Err(e) if e.to_string().contains(\"Refusing to disable Apple service\") => {\n        eprintln!(\"Apple services are protected; use launchctl manually if you accept the risk\");\n    }\n    other => other?,\n}","preventionTips":["Filter service lists to exclude Apple-category services before scripting disables.","Double-check the service id — a typo may resolve to an Apple service.","Treat Apple system services as read-only in automation."],"tags":["macos","launchctl","safety-guard","service-management"],"backgroundTag":"operation-blocked-by-safety-guard","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}