<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "os",
  "identifier" : "/documentation/os/OSLogInt32ExtendedFormat/darwinMode",
  "metadataVersion" : "0.1.0",
  "role" : "Case",
  "symbol" : {
    "kind" : "Case",
    "modules" : [
      "os"
    ],
    "preciseIdentifier" : "s:2os24OSLogInt32ExtendedFormatO10darwinModeyA2CmF"
  },
  "title" : "OSLogInt32ExtendedFormat.darwinMode"
}
-->

# OSLogInt32ExtendedFormat.darwinMode

A format that displays a 32-bit integer as a Darwin file mode.

```
case darwinMode
```

## Discussion

Use this option to format the interpolated value as a Darwin file mode, such as `-rwx------`. Because Darwin uses octal values to represent file modes numerically, pass an octal literal to the formatter. Alternatively, convert the octal value to its 32-bit integer equivalent and interpolate that instead. For more information about using octal literals, see [Numeric Literals](https://docs.swift.org/swift-book/LanguageGuide/TheBasics.html#ID323).

The following example formats the octal literal `0o700` using the `darwinMode` formatter:

```swift
// Create a logger with the specified subsystem and category.
let logger = Logger(subsystem: "com.example.OSLogValueFormatting",
                    category: "Formatter Output")
        
// Darwin uses octal values to represent file modes. Use Swift's
// support for octal literals to assign a file mode to a 32-bit 
// integer variable.
let value: Int32 = 0o700
        
// Write the value to the log using the specified format.
logger.info(".darwinMode output is \(value, format: .darwinMode)")
```

And the system writes the following message to the log:

```
[Formatter Output] .darwinMode formats the value as -rwx------
```

---

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)