<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZFileSerialPortAttachment/init(url:append:)-37g72",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZFileSerialPortAttachment(im)initWithURL:append:error:"
  },
  "title" : "init(url:append:)"
}
-->

# init(url:append:)

Creates a file-based serial port attachment object.

```
init(url: URL, append shouldAppend: Bool) throws
```

## Parameters

`url`

The URL of a file on the local file system. The specified file must be writable by the virtual machine.

`shouldAppend`

A Boolean that indicates whether the virtual machine opens the file in append mode. Specify <doc://com.apple.documentation/documentation/Swift/true> to append data to the file, and specify <doc://com.apple.documentation/documentation/Swift/false> to replace the contents of the file with any new data.

## Return Value

A file-based serial port attachment on success, or `nil` if initialization failed.

## Discussion

---

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)