---
title: "unmountVolume(at:options:completionHandler:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/filemanager/unmountvolume(at:options:completionhandler:)"
---

# unmountVolume(at:options:completionHandler:)

Starts the process of unmounting the specified volume.

## Declaration

```swift
func unmountVolume(at url: URL, options mask: FileManager.UnmountOptions = [], completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func unmountVolume(at url: URL, options mask: FileManager.UnmountOptions = []) async throws
```

## Parameters

- `url`: A file URL specifying the volume to be unmounted.
- `mask`: A bitmask of doc://com.apple.foundation/documentation/Foundation/FileManager/UnmountOptions that you can use to customize the unmount operation’s behavior.
- `completionHandler`: A block executed when the unmount operation completes. The block receives an error parameter which is nil if unmounting was successful. Otherwise, it indicates why unmounting failed.

## Discussion

Discussion If the volume is encrypted, it is relocked after being unmounted.

## See Also

### Unmounting volumes

- [FileManager.UnmountOptions](foundation/filemanager/unmountoptions.md)
- [NSFileManagerUnmountDissentingProcessIdentifierErrorKey](foundation/nsfilemanagerunmountdissentingprocessidentifiererrorkey.md)
