You can use POSIX API in Swift on MacOS

Swift on macOS can access POSIX APIs by importing the Darwin module. This gives you access to low-level system calls, file operations, and other Unix functionality. In my case I needed to call openpty() function from Swift application and handle raw file descriptors. import Darwin // Example: Get current working directory let cwd = getcwd(nil, 0) if let path = cwd { print("Current directory: \(String(cString: path))") free(cwd) } // Example: Create a directory (if app is not sandboxed) let result = mkdir("/tmp/testdir", 0o755) if result == 0 { print("Directory created successfully") } else { print("Failed to create directory: \(errno)") }

July 9, 2025 · 1 min · 100 words · Maxim

Maximum DriverKit Driver Bundle Identifier Length is 64 Characters

If you get sysex didFailWithError: extension category returned error error when trying to Install Dext from Communicating between a DriverKit extension and a client app sample application, in Xcode change Bundle Identifier for DriverKitSampleApp and NullDriver to shorter ones, length should not exceed 64 characters. For example, replace com.example.apple-samplecode.dext-to-user-client with com.example.dext-to-user-client- to make sure whole identifier is not longer than 64 chars, as suggested on Apple Developer Forums.

July 6, 2025 · 1 min · 68 words · Maxim

Creating and Restoring Disk Images on macOS: A Guide to Using dd and diskutil

Disk imaging on macOS using dd and diskutil - create, restore, and verify disk images. Includes optimization techniques with compression and sparse files, plus SHA1 verification for data integrity.

May 4, 2025 · 12 min · 2408 words · Maxim