---
title: "MIDISetupRemoveDevice(_:)"
framework: coremidi
role: symbol
role_heading: Function
path: "coremidi/midisetupremovedevice(_:)"
---

# MIDISetupRemoveDevice(_:)

Removes a driver-owned MIDI device from the current MIDI setup.

## Declaration

```swift
func MIDISetupRemoveDevice(_ device: MIDIDeviceRef) -> OSStatus
```

## Parameters

- `device`: The device to remove.

## Return Value

Return Value An OSStatus result code.

## Discussion

Discussion Typically, only a studio-configuration editor calls this function to remove a device that’s offline and which the user has specified as permanently missing. It’s a good practice to have drivers set the deviceʼs kMIDIPropertyOffline to 1, instead of removing the device from the setup, so if the device reappears later, the system preserves the deviceʼs property state.

## See Also

### Managing Devices

- [MIDISetupAddDevice(_:)](coremidi/midisetupadddevice(_:).md)
