{
  "name": "launchctl",
  "description": "Interfaces with launchd",
  "args": [
    {}
  ],
  "subcommands": [
    {
      "name": "bootstrap",
      "description": "Bootstraps a domain or a service into a domain",
      "args": [
        {
          "name": "service",
          "description": "Service or domain target",
          "template": "filepaths"
        },
        {
          "name": "service-path",
          "description": "Service path(s)",
          "isVariadic": true,
          "template": "filepaths"
        }
      ]
    },
    {
      "name": "bootout",
      "description": "Tears down a domain or removes a service from a domain",
      "args": [
        {
          "name": "service",
          "description": "Service or domain target",
          "template": "filepaths"
        },
        {
          "name": "service-path",
          "description": "Service path(s)",
          "isVariadic": true,
          "template": "filepaths"
        }
      ]
    },
    {
      "name": "enable",
      "description": "Enables an existing service",
      "args": [
        {
          "name": "service",
          "description": "Service or domain target"
        }
      ]
    },
    {
      "name": "disable",
      "description": "Disables an existing service",
      "args": [
        {
          "name": "service",
          "description": "Service or domain target"
        }
      ]
    },
    {
      "name": "kickstart",
      "description": "Forces an existing service to start",
      "options": [
        {
          "names": [
            "-k"
          ],
          "description": "Kill instance before restarting"
        },
        {
          "names": [
            "-p"
          ],
          "description": "Print PID"
        }
      ],
      "args": [
        {
          "name": "service",
          "description": "Service or domain target"
        }
      ]
    },
    {
      "name": "attach",
      "description": "Attach the system's debugger to a service",
      "options": [
        {
          "names": [
            "-k"
          ],
          "description": "Kill instance"
        },
        {
          "names": [
            "-s"
          ],
          "description": "Force the service to start"
        },
        {
          "names": [
            "-x"
          ],
          "description": "Attach xpcproxy"
        }
      ],
      "args": [
        {
          "name": "service",
          "description": "Service or domain target"
        }
      ]
    },
    {
      "name": "debug",
      "description": "Configures the next invocation of a service for debugging",
      "options": [
        {
          "names": [
            "--program"
          ],
          "description": "Use program path as executable",
          "args": [
            {
              "name": "program-path"
            }
          ]
        },
        {
          "names": [
            "--guard-malloc"
          ],
          "description": "Turn on libgmalloc"
        },
        {
          "names": [
            "--malloc-stack-logging"
          ],
          "description": "Turn on malloc(3) stack logging"
        },
        {
          "names": [
            "--malloc-nano-allocator"
          ],
          "description": "Turn on malloc(3) nano allocator"
        },
        {
          "names": [
            "--debug-libraries"
          ],
          "description": "Set the DYLD_IMAGE_SUFFIX"
        },
        {
          "names": [
            "--introspection-libraries"
          ],
          "description": "Add introspection libraries to the DYLD_IMAGE_PATH"
        },
        {
          "names": [
            "--NSZombie"
          ],
          "description": "Enables NSZombie"
        },
        {
          "names": [
            "--32"
          ],
          "description": "Runs service on appropriate 32-bit architecture"
        },
        {
          "names": [
            "--stdin"
          ],
          "description": "Sets the stdin path",
          "args": [
            {
              "name": "stdin-path",
              "template": "filepaths"
            }
          ]
        },
        {
          "names": [
            "--stdout"
          ],
          "description": "Sets the stdout path",
          "args": [
            {
              "name": "stdout-path",
              "template": "filepaths"
            }
          ]
        },
        {
          "names": [
            "--stderr"
          ],
          "description": "Sets the stderr path",
          "args": [
            {
              "name": "stderr-path",
              "template": "filepaths"
            }
          ]
        },
        {
          "names": [
            "--environment"
          ],
          "description": "Sets environment variables",
          "args": [
            {
              "name": "environment-variables",
              "isVariadic": true
            }
          ]
        }
      ],
      "args": [
        {
          "name": "argv",
          "description": "Variable args: argv0 argv1",
          "isVariadic": true
        }
      ]
    },
    {
      "name": "kill",
      "description": "Sends a signal to the service instance",
      "args": [
        {
          "name": "signal",
          "description": "Specify signal-name or signal-number"
        },
        {
          "name": "service",
          "description": "Service or domain target"
        }
      ]
    },
    {
      "name": "blame",
      "description": "Prints the reason a service is running",
      "args": [
        {
          "name": "service",
          "description": "Service or domain target"
        }
      ]
    },
    {
      "name": "print",
      "description": "Prints a description of a domain or service",
      "args": [
        {
          "name": "service",
          "description": "Service or domain target",
          "template": "filepaths"
        }
      ]
    },
    {
      "name": "print-cache",
      "description": "Prints information about the service cache"
    },
    {
      "name": "print-disabled",
      "description": "Prints which services are disabled",
      "args": [
        {
          "name": "domain-target"
        }
      ]
    },
    {
      "name": "plist",
      "description": "Prints a property list embedded in a binary (targets the Info.plist by default)",
      "args": [
        {
          "name": "segment",
          "description": "Segment or section"
        },
        {
          "name": "Mach-O",
          "isOptional": true,
          "template": "filepaths"
        }
      ]
    },
    {
      "name": "procinfo",
      "description": "Prints port information about a process",
      "args": [
        {
          "name": "pid"
        }
      ]
    },
    {
      "name": "hostinfo",
      "description": "Prints port information about the host"
    },
    {
      "name": "resolveport",
      "description": "Resolves a port name from a process to an endpoint in launchd",
      "args": [
        {
          "name": "owner-pid"
        },
        {
          "name": "port-name"
        }
      ]
    },
    {
      "name": "limit",
      "description": "Reads or modifies launchd's resource limits",
      "options": [
        {
          "names": [
            "cpu"
          ],
          "args": [
            {
              "name": "[both]",
              "description": "Specify a limit for both soft and hard"
            },
            {
              "name": "[soft | hard]",
              "description": "Specify a soft/hard limit pair",
              "isOptional": true
            }
          ]
        },
        {
          "names": [
            "filesize"
          ],
          "args": [
            {
              "name": "[both]",
              "description": "Specify a limit for both soft and hard"
            },
            {
              "name": "[soft | hard]",
              "description": "Specify a soft/hard limit pair",
              "isOptional": true
            }
          ]
        },
        {
          "names": [
            "data"
          ],
          "args": [
            {
              "name": "[both]",
              "description": "Specify a limit for both soft and hard"
            },
            {
              "name": "[soft | hard]",
              "description": "Specify a soft/hard limit pair",
              "isOptional": true
            }
          ]
        },
        {
          "names": [
            "stack"
          ],
          "args": [
            {
              "name": "[both]",
              "description": "Specify a limit for both soft and hard"
            },
            {
              "name": "[soft | hard]",
              "description": "Specify a soft/hard limit pair",
              "isOptional": true
            }
          ]
        },
        {
          "names": [
            "core"
          ],
          "args": [
            {
              "name": "[both]",
              "description": "Specify a limit for both soft and hard"
            },
            {
              "name": "[soft | hard]",
              "description": "Specify a soft/hard limit pair",
              "isOptional": true
            }
          ]
        },
        {
          "names": [
            "rss"
          ],
          "args": [
            {
              "name": "[both]",
              "description": "Specify a limit for both soft and hard"
            },
            {
              "name": "[soft | hard]",
              "description": "Specify a soft/hard limit pair",
              "isOptional": true
            }
          ]
        },
        {
          "names": [
            "memlock"
          ],
          "args": [
            {
              "name": "[both]",
              "description": "Specify a limit for both soft and hard"
            },
            {
              "name": "[soft | hard]",
              "description": "Specify a soft/hard limit pair",
              "isOptional": true
            }
          ]
        },
        {
          "names": [
            "maxproc"
          ],
          "args": [
            {
              "name": "[both]",
              "description": "Specify a limit for both soft and hard"
            },
            {
              "name": "[soft | hard]",
              "description": "Specify a soft/hard limit pair",
              "isOptional": true
            }
          ]
        },
        {
          "names": [
            "maxfiles"
          ],
          "args": [
            {
              "name": "[both]",
              "description": "Specify a limit for both soft and hard"
            },
            {
              "name": "[soft | hard]",
              "description": "Specify a soft/hard limit pair",
              "isOptional": true
            }
          ]
        }
      ]
    },
    {
      "name": "runstats",
      "description": "Prints performance statistics for a service",
      "args": [
        {
          "name": "service",
          "description": "Service or domain target"
        }
      ]
    },
    {
      "name": "examine",
      "description": "Runs the specified analysis tool against launchd in a non-re-entrant manner",
      "args": [
        {
          "name": "tool"
        },
        {
          "name": "[args | @PID]",
          "isVariadic": true
        }
      ]
    },
    {
      "name": "config",
      "description": "Modifies persistent configuration parameters for launchd domains",
      "args": [
        {
          "name": "[system | user]",
          "suggestions": [
            "system"
          ]
        },
        {
          "name": "param",
          "description": "A key for a key/value pair"
        },
        {
          "name": "value",
          "description": "A value for a key/value pair"
        }
      ]
    },
    {
      "name": "dumpstate",
      "description": "Dumps launchd state to stdout"
    },
    {
      "name": "dumpjpcategory",
      "description": "Dumps the jetsam properties category for all services"
    },
    {
      "name": "reboot",
      "description": "Initiates a system reboot of the specified type",
      "options": [
        {
          "names": [
            "system"
          ]
        },
        {
          "names": [
            "userspace"
          ]
        },
        {
          "names": [
            "halt"
          ]
        },
        {
          "names": [
            "logout"
          ]
        },
        {
          "names": [
            "apps"
          ]
        }
      ]
    },
    {
      "name": "load",
      "description": "Recommended alternatives: bootstrap | enable. Bootstraps a service or directory of services",
      "options": [
        {
          "names": [
            "-w"
          ],
          "description": "Enable if disabled"
        },
        {
          "names": [
            "-F"
          ],
          "description": "Force load"
        },
        {
          "names": [
            "-S"
          ],
          "description": "Session",
          "args": [
            {
              "name": "session"
            }
          ]
        },
        {
          "names": [
            "-D"
          ],
          "description": "Load files from specified domain",
          "args": [
            {
              "name": "domain"
            }
          ]
        }
      ],
      "args": [
        {
          "name": "path",
          "isVariadic": true,
          "template": "filepaths"
        }
      ]
    },
    {
      "name": "unload",
      "description": "Recommended alternatives: bootout | disable. Unloads a service or directory of services",
      "options": [
        {
          "names": [
            "-w"
          ],
          "description": "Enable if disabled"
        },
        {
          "names": [
            "-F"
          ],
          "description": "Force load"
        },
        {
          "names": [
            "-S"
          ],
          "description": "Session",
          "args": [
            {
              "name": "session"
            }
          ]
        },
        {
          "names": [
            "-D"
          ],
          "description": "Load files from specified domain",
          "args": [
            {
              "name": "domain"
            }
          ]
        }
      ],
      "args": [
        {
          "name": "path",
          "isVariadic": true,
          "template": "filepaths"
        }
      ]
    },
    {
      "name": "remove",
      "description": "Unloads the specified service name",
      "args": [
        {
          "name": "label",
          "generators": [
            {
              "script": [
                "launchctl",
                "list"
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "list",
      "description": "Lists information about services",
      "args": [
        {
          "name": "label",
          "isOptional": true,
          "generators": [
            {
              "script": [
                "launchctl",
                "list"
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "start",
      "description": "Starts the specified service",
      "args": [
        {
          "name": "label",
          "generators": [
            {
              "script": [
                "launchctl",
                "list"
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "stop",
      "description": "Stops the specified service if it is running",
      "args": [
        {
          "name": "label",
          "generators": [
            {
              "script": [
                "launchctl",
                "list"
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "setenv",
      "description": "Sets the specified environment variables for all services within the domain",
      "args": [
        {
          "name": "key"
        },
        {
          "name": "value"
        }
      ]
    },
    {
      "name": "unsetenv",
      "description": "Unsets the specified environment variables for all services within the domain",
      "args": [
        {
          "name": "key"
        }
      ]
    },
    {
      "name": "getenv",
      "description": "Gets the value of an environment variable from within launchd",
      "args": [
        {
          "name": "key"
        }
      ]
    },
    {
      "name": "bsexec",
      "description": "Execute a program in another process' bootstrap context",
      "args": [
        {
          "name": "PID"
        },
        {
          "name": "command"
        },
        {
          "name": "args",
          "isOptional": true,
          "isVariadic": true
        }
      ]
    },
    {
      "name": "asuser",
      "description": "Execute a program in the bootstrap context of a given user",
      "args": [
        {
          "name": "UID"
        },
        {
          "name": "command"
        },
        {
          "name": "args",
          "isOptional": true,
          "isVariadic": true
        }
      ]
    },
    {
      "name": "submit",
      "description": "Submit a basic job from the command line",
      "options": [
        {
          "names": [
            "-p"
          ],
          "description": "Program to execute",
          "args": [
            {
              "name": "executable"
            }
          ]
        },
        {
          "names": [
            "-o"
          ],
          "description": "Std out path",
          "args": [
            {
              "name": "stdout-path",
              "template": "filepaths"
            }
          ]
        },
        {
          "names": [
            "-e"
          ],
          "description": "Std err path",
          "args": [
            {
              "name": "stderr-path",
              "template": "filepaths"
            }
          ]
        }
      ],
      "args": [
        {
          "name": "-l",
          "description": "Label flag"
        },
        {
          "name": "label",
          "description": "Unique label to assign to launchd",
          "generators": [
            {
              "script": [
                "launchctl",
                "list"
              ]
            }
          ]
        },
        {
          "name": "command",
          "description": "Command to run"
        },
        {
          "name": "arg",
          "isOptional": true,
          "isVariadic": true
        }
      ]
    },
    {
      "name": "managerpid",
      "description": "Prints the PID of the launchd controlling the session"
    },
    {
      "name": "manageruid",
      "description": "Prints the UID of the current launchd session"
    },
    {
      "name": "managername",
      "description": "Prints the name of the current launchd session"
    },
    {
      "name": "error",
      "description": "Prints a description of an error",
      "args": [
        {
          "name": "type",
          "description": "Error domain type",
          "suggestions": [
            "posix",
            "mach",
            "bootstrap"
          ]
        },
        {
          "name": "code",
          "description": "Numeric code"
        }
      ]
    },
    {
      "name": "variant",
      "description": "Prints the launchd variant"
    },
    {
      "name": "version",
      "description": "Prints the launchd version"
    },
    {
      "name": "help",
      "description": "Prints the usage for a given subcommand"
    }
  ]
}
