<!--
{
  "availability" : [
    "iOS: -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ServiceManagement",
  "identifier" : "/documentation/ServiceManagement/SMAppService/unregister()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Service Management"
    ],
    "preciseIdentifier" : "c:objc(cs)SMAppService(im)unregisterAndReturnError:"
  },
  "title" : "unregister()"
}
-->

# unregister()

Unregisters the service so the system no longer launches it.

```
func unregister() throws
```

## Discussion

This is the opposite operation of [`register()`](/documentation/ServiceManagement/SMAppService/register()).

If the service corresponds to a LoginItem, LaunchAgent, or LaunchDaemon and the service is currently running it, the system terminates it. If the service corresponds to the main application, it continues running, but becomes unregistered to prevent future launches at login.

If the service is already unregistered, this method returns [`kSMErrorJobNotFound`](/documentation/ServiceManagement/kSMErrorJobNotFound).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)