<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "System",
  "identifier" : "/documentation/System/FileDescriptor/close()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "System"
    ],
    "preciseIdentifier" : "s:6System14FileDescriptorV5closeyyKF"
  },
  "title" : "close()"
}
-->

# close()

Deletes a file descriptor.

```
func close() throws
```

## Discussion

Deletes the file descriptor from the per-process object reference table.
If this is the last reference to the underlying object,
the object will be deactivated.

The corresponding C function is `close`.

---

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)