Maintain Homebrew for Apple Silicon and Rosetta

I needed to have Homebrew available for x86_64 in Rosetta mode without conflicting with native Apple Silicon mode. To do that: Instantiate a new Terminal running in Rosetta: open -a Terminal --new --arch x86_64 In the new Terminal, install Homebrew as per the official manual: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" Edit .zprofile to: Output current architecture Add x86 to Terminal title when running in Rosetta mode Use corresponding brew version to match current architecture title() { printf '\e]0;%s\a' "$1" } # Detect architecture and set up Homebrew accordingly ARCH=$(arch) echo "Current architecture: $ARCH" if [[ $ARCH == "arm64" ]]; then # Apple Silicon eval "$(/opt/homebrew/bin/brew shellenv)" else title "x86" # Intel eval "$(/usr/local/bin/brew shellenv)" fi

August 22, 2025 · 1 min · 115 words · Maxim

Run Applications in Rosetta on macOS

I needed to run Terminal in x86_64 mode (Rosetta) in parallel with Terminal in arm64 (Apple Silicon native mode), but in the latest versions of macOS, the old way of creating a copy of the Terminal application and selecting Open using Rosetta in Get Info is not available, since Terminal can’t be copied anymore due to security restrictions. To overcome this, you can use the following command to open any application in Rosetta mode from either Terminal or Automator: ...

August 22, 2025 · 1 min · 157 words · Maxim

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