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

# SMAppService

An object the framework uses to control helper executables that live inside an app’s main bundle.

```
class SMAppService
```

## Overview

In macOS 13 and later, use `SMAppService` to register and control `LoginItems`, `LaunchAgents`, and `LaunchDaemons` as helper executables for your app. When converting code from earlier versions of macOS, use an `SMAppService` object and select one of the following methods depending on the type of service your helper executable provides:

- For `SMAppServices` initialized as `LoginItems`, the [`register()`](/documentation/ServiceManagement/SMAppService/register()) and [`unregister()`](/documentation/ServiceManagement/SMAppService/unregister()) APIs provide a replacement for [`SMLoginItemSetEnabled(_:_:)`](/documentation/ServiceManagement/SMLoginItemSetEnabled(_:_:)).
- For `SMAppServices` initialized as `LaunchAgents`, the [`register()`](/documentation/ServiceManagement/SMAppService/register()) and [`unregister()`](/documentation/ServiceManagement/SMAppService/unregister()) methods provide a replacement for installing property lists in `~/Library/LaunchAgents` or `/Library/LaunchAgents`.
- For `SMAppServices` initialized as `LaunchDaemons`, the [`register()`](/documentation/ServiceManagement/SMAppService/register()) and [`unregister()`](/documentation/ServiceManagement/SMAppService/unregister()) methods provide a replacement for installing property lists in `/Library/LaunchDaemons`.

## Topics

### Registering services

[`register()`](/documentation/ServiceManagement/SMAppService/register())

Registers the service so it can begin launching subject to user approval.

[`unregister()`](/documentation/ServiceManagement/SMAppService/unregister())

Unregisters the service so the system no longer launches it.

[`unregister(completionHandler:)`](/documentation/ServiceManagement/SMAppService/unregister(completionHandler:))

Unregisters the service so the system no longer launches it and calls a completion handler you provide with the resulting error value.

### Managing apps

[`mainApp`](/documentation/ServiceManagement/SMAppService/mainApp)

An app service object that corresponds to the main application as a login item.

[`agent(plistName:)`](/documentation/ServiceManagement/SMAppService/agent(plistName:))

Initializes an app service object with a launch agent with the property list name you provide.

[`daemon(plistName:)`](/documentation/ServiceManagement/SMAppService/daemon(plistName:))

Initializes an app service object with a launch daemon with the property list name you provide.

[`loginItem(identifier:)`](/documentation/ServiceManagement/SMAppService/loginItem(identifier:))

Initializes an app service object for a login item corresponding to the bundle with the identifier you provide.

### Interacting with System Settings

[`openSystemSettingsLoginItems()`](/documentation/ServiceManagement/SMAppService/openSystemSettingsLoginItems())

Opens System Settings to the Login Items control panel.

### Getting the state of the service

[`status`](/documentation/ServiceManagement/SMAppService/status-swift.property)

A property that describes registration or authorization state of the service.

[`SMAppService.Status`](/documentation/ServiceManagement/SMAppService/Status-swift.enum)

Constants that describe the registration or authorization status of a helper executable.

### Checking authorization for earlier OS version login items

[`statusForLegacyPlist(at:)`](/documentation/ServiceManagement/SMAppService/statusForLegacyPlist(at:))

Check the authorization status of an earlier OS version login item.



---

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)