---
title: "unmountAndEjectDevice(atPath:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsworkspace/unmountandejectdevice(atpath:)"
---

# unmountAndEjectDevice(atPath:)

Unmounts and ejects the device at the specified path.

## Declaration

```swift
func unmountAndEjectDevice(atPath path: String) -> Bool
```

## Parameters

- `path`: The path to the device.

## Return Value

Return Value true if the system unmounted the device; otherwise, false.

## Discussion

Discussion When this method begins, it posts an willUnmountNotification to the NSWorkspace object’s notification center. When it is finished, it posts an didUnmountNotification. Prefer the unmountAndEjectDevice(at:) method because it provides more detailed error information. You can safely call this method from any thread of your app.

## See Also

### Unmounting a Device

- [unmountAndEjectDevice(at:)](appkit/nsworkspace/unmountandejectdevice(at:).md)
