coreml-cli
A native command-line interface for working with Apple Core ML models on macOS
coreml-cli: Core ML models from the terminal
A native command line tool for Core ML models on macOS that inspects, predicts, batches, benchmarks, and compiles them, with no Xcode and no Python in the loop.
A CLI in place of the heavy tools
coreml-cli is a native command line interface for working with Apple Core ML models on macOS. The pitch is that you can inspect, run inference, benchmark, and manage Core ML models without Xcode or Python. The tool works against model files such as mlmodel, mlpackage, and compiled mlmodelc.
The command set
The commands map to the common workflows. inspect views the model structure, inputs, outputs, and metadata. predict runs inference on images, text, or JSON data. batch processes multiple files with concurrent execution. benchmark measures inference latency and throughput. compile converts between model formats.
Editing metadata
Setting a metadata field on an mlmodel or mlpackage rewrites the model spec in place at the protobuf level, without Python or coremltools. For mlpackage inputs, an output flag clones the entire package directory and writes the modified spec inside the clone. Compiled mlmodelc models are read only, which makes sense given how they are built.
Command reference
A command reference table lists the available commands: coreml inspect for model structure and metadata, coreml predict for running inference on a single input, coreml batch for processing multiple inputs, and coreml benchmark. Global options include JSON output, a compute device flag for cpu, gpu, ane, or all, plus help and version.
Inputs you can feed it
Supported input types cover the main Core ML categories. Images with jpg, jpeg, png, and heic extensions feed vision models. Audio wav files go to sound classification, text txt files to NLP models, and tensors as JSON to custom models like tabular data or embeddings. The requirements are macOS 13.0 or later on Apple Silicon or Intel Macs.
Editorial conclusion
For people who live in the terminal, coreml-cli covers the common Core ML chores, including editing metadata straight at the protobuf level, without pulling in Xcode or a Python environment.
Community notes