<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFBundleUnloadExecutable(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFBundleUnloadExecutable"
  },
  "title" : "CFBundleUnloadExecutable(_:)"
}
-->

# CFBundleUnloadExecutable(_:)

Unloads the main executable for the specified bundle.

```
func CFBundleUnloadExecutable(_ bundle: CFBundle!)
```

## Parameters

`bundle`

The bundle whose main executable you want to unload.

## Discussion

You should typically try to avoid using this function, but instead use [`CFBundleGetFunctionPointerForName(_:_:)`](/documentation/CoreFoundation/CFBundleGetFunctionPointerForName(_:_:)) and related functions since these make management of the bundle easier (when the last reference to the CFBundle object is released, and it is finally deallocated, then the code will be unloaded if it is still loaded, and if the executable is of a type that supports unloading).

---

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)