# Use USB devices

Attach a USB drive, security key, webcam, or other device plugged into your Mac to a running machine.

## Give a device to OSMates

macOS decides which app gets a USB device, and you choose once for each device.

1. Start a machine.
2. Plug the device into your Mac.
3. In the menu bar, open the **Virtual Machine Accessories** menu and choose the device for OSMates.

The device now shows in the list of every running machine.

## Attach a device

1. Select the running machine, choose **Machine > Machine Settings**, then click **USB**.
2. Click **Attach** next to the device.

The machine remembers the device and attaches it again whenever it comes back. In a machine's window, **I/O > USB Devices** does the same.

```sh
osmates vm usb list dev
osmates vm usb attach dev 0781:5581
```

When two devices share an ID, add `--serial` with the serial the list shows.

## Detach a device

Eject a drive in the guest first, since a program that uses the device loses it.

1. Select the machine, choose **Machine > Machine Settings**, then click **USB**.
2. Click **Detach** next to the device.

To forget a device that isn't plugged in, click **Forget** under **Remembered**.

```sh
osmates vm usb detach dev 0781:5581
```

## Use a webcam, microphone, or Bluetooth adapter

Windows machines and Linux machines on the OSMates engine take these devices, and [other machines](https://osmates.com/docs/engines) can refuse them.

1. Give the device to OSMates in the **Virtual Machine Accessories** menu.
2. Select the machine, choose **Machine > Machine Settings**, then click **USB**.
3. Click **Attach** next to the device, read the warning, then click **Attach** in the alert.
4. For a Bluetooth adapter, turn on Bluetooth in the guest, then pair your keyboard, mouse, or headset there.

Apps on your Mac can't use the device until you detach it. Devices paired in the guest connect only to the machine. To give a machine your Mac's built-in camera instead, see [Use your Mac's camera](https://osmates.com/docs/camera).

## If a machine refuses a device

A machine set to Allowed Destinations Only or Blocked, and an agent sandbox, refuse devices that could reach the network. These have a communications, CDC data, wireless controller, or vendor-specific interface, as many USB Ethernet adapters and every Bluetooth adapter do.

On Apple Virtualization, a Linux machine without a display has USB only when it starts with a disc or remembered device. Attach the device, then shut the machine down and start it again.

## Limits

- A machine with a USB device attached can't suspend or save its memory in a snapshot. Automatic snapshots save only the disks.
- A device goes to one machine at a time.
- On the OSMates engine, a machine takes up to 8 USB 3 devices and 8 other USB devices at once.
- A card in your Mac's SD slot isn't a USB device. A USB card reader passes through with its card.
- Video and sound from a camera, microphone, or headset can skip while your Mac is busy.
