<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.5.0 - 10.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecHostRemoveGuest",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecHostRemoveGuest"
  },
  "title" : "SecHostRemoveGuest"
}
-->

# SecHostRemoveGuest

Removes a guest from a host.

```
OSStatus SecHostRemoveGuest(SecGuestRef host, SecGuestRef guest, SecCSFlags flags);
```

## Parameters

`host`

The guest code object of the host of the guest. You cannot specify a host of a host here except in the case of a dedicated host. For a dedicated host, the dedicated host is automatically substituted for its guest. See [`kSecCSDedicatedHost`](/documentation/Security/kSecCSDedicatedHost) for a discussion of dedicated hosts.

`guest`

The guest code object for the guest whose guest relationship you wish to terminate.

`flags`

Optional flags; see [`SecCSFlags`](/documentation/Security/SecCSFlags) for possible values. Pass [`kSecCSDefaultFlags`](/documentation/Security/SecCSFlags/kSecCSDefaultFlags) for standard behavior.

## Return Value

A result code. See [Code Signing Services Result Codes](/documentation/Security/code-signing-services-result-codes).

## Discussion

This function removes all memory of the guest-host relationship from the Code Signing Services hosting system. You cannot remove a dedicated guest. The specified guest must have been created using the [`SecHostCreateGuest`](/documentation/Security/SecHostCreateGuest) function. If you remove a guest that is also a host, all of the guest’s guests are removed, recursively, as well, even if one or more of those guests are dedicated hosts.

## See Also

[`SecHostCreateGuest`](/documentation/Security/SecHostCreateGuest)

Creates a new guest and describes its initial properties.



---

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)