<!--
{
  "availability" : [
    "macOS: 10.6.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWorkspace/launchApplication(at:options:configuration:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSWorkspace(im)launchApplicationAtURL:options:configuration:error:"
  },
  "title" : "launchApplication(at:options:configuration:)"
}
-->

# launchApplication(at:options:configuration:)

Launches the app at the specified URL.

```
func launchApplication(at url: URL, options: NSWorkspace.LaunchOptions = [], configuration: [NSWorkspace.LaunchConfigurationKey : Any]) throws -> NSRunningApplication
```

## Parameters

`url`

The application URL.

`options`

Options to use when launching the application. See [`NSWorkspace.LaunchOptions`](/documentation/AppKit/NSWorkspace/LaunchOptions) for possible values.

`configuration`

A dictionary containing the configuration options.  This dictionary can be used to pass additional options to the app. The configuration dictionary may be empty, in which case default behavior applies.

## Return Value

If the app is already running, and [`newInstance`](/documentation/AppKit/NSWorkspace/LaunchOptions/newInstance) is not specified in the `options` dictionary, then a reference to the existing app is returned; otherwise a new application reference is returned. If the application could not be launched, `nil` is returned and the error is specified in `error`.

## Discussion

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

> Handling Errors in Swift:
> In Swift, this method returns a nonoptional result and is marked with the `throws` keyword to indicate that it throws an error in cases of failure.
> 
> You call this method in a `try` expression and handle any errors in the `catch` clauses of a `do` statement, as described in [Error Handling](https://docs.swift.org/swift-book/LanguageGuide/ErrorHandling.html) in [The Swift Programming Language](https://docs.swift.org/swift-book/) and `About Imported Cocoa Error Parameters`.

---

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)