<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URL/temporaryDirectory",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation3URLV18temporaryDirectoryACvpZ"
  },
  "title" : "temporaryDirectory"
}
-->

# temporaryDirectory

The standard directory for temporary files.

```
static var temporaryDirectory: URL { get }
```

## Discussion

In iOS, this directory is within the app’s sandbox directory. In macOS, it’s within the app’s sandbox directory for sandboxed apps, or in a path under `/var` if the app isn’t sandboxed.

This computed property is equivalent to calling [`NSSearchPathForDirectoriesInDomains(_:_:_:)`](/documentation/Foundation/NSSearchPathForDirectoriesInDomains(_:_:_:)) with the [`FileManager.SearchPathDirectory.itemReplacementDirectory`](/documentation/Foundation/FileManager/SearchPathDirectory/itemReplacementDirectory) parameter.

---

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)