TIL how to build netpbm on macOS. Running ./configure succeeds, but make fails with an error. I checked the netpbm Homebrew formula and reviewed the formula code, which applies some fixes in config.mk. Now I can try wrapping libnetpbm into a Swift package.

Dug in Libnetpbm User’s Guide.

TIL interesting method of reading stdin in Swift:

import Foundation

if let input = try? String(contentsOfFile: "/dev/stdin", encoding: .utf8) {
    print("Input from file: \(input)")
}

This reads the entire content of stdin as a string. This method is useful if you’re dealing with redirected input from files or other streams.