<!--
{
  "availability" : [
    "macOS: 10.0.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWorkspace/openFile(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSWorkspace(im)openFile:"
  },
  "title" : "openFile(_:)"
}
-->

# openFile(_:)

Opens the specified file specified using the default app associated with its type.

```
func openFile(_ fullPath: String) -> Bool
```

## Parameters

`fullPath`

The full path to the file.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the file was successfully opened; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

The sending app is deactivated before the request is sent.

It is safe to call this method from any thread in your app in macOS 10.6 and later.

---

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)