Mac Terminal converts HEIC to JPG with sips, the built-in scriptable image processing system. The syntax covers single files, JPEG quality settings, batch folder processing, and resizing during conversion. Work with large folders of iPhone HEIC photos without opening Preview or Photos.
What is Sips and Why Use It?
sips is a command-line tool included with macOS. It reads and writes many image formats, including HEIC and JPEG. Because it runs from Terminal, you process hundreds of files without opening a graphical application. The tool adds no watermarks, requires no internet connection, and works entirely on your machine.
Convert a Single HEIC File
Convert one file with the sips command, the -s format jpeg option, the source file, and the --out flag for the output file name.
Example:
sips -s format jpeg IMG_0001.HEIC --out IMG_0001.jpgThis creates a new JPEG file named IMG_0001.jpg in the same folder. Omit --out and sips modifies the original HEIC file in place. Avoid that.
Set JPEG Quality
Quality Values And File Size
Control JPEG output quality with the -s formatOptions flag followed by a quality value. Use a number from 0 to 100, where higher numbers produce larger files with less compression. Or use the words low, normal, high, or best.
Example with a high numeric quality:
sips -s format jpeg -s formatOptions high IMG_0001.HEIC --out IMG_0001.jpgExample using a word:
sips -s format jpeg -s formatOptions high IMG_0001.HEIC --out IMG_0001.jpgWithout formatOptions, sips uses its default compression level.
Batch Convert an Entire Folder
Loop Through Every HEIC File
For a folder full of HEIC files, use a shell loop to process each one. This example works with files that have an upper-case .HEIC extension, which iPhone photos use.
Open Terminal, navigate to the folder containing your HEIC files, then run:
for f in *.HEIC; do sips -s format jpeg "$f" --out "${f%.*}.jpg"; doneThis loop does the following:
- for f in *.HEIC matches every file ending in .HEIC in the current folder.
- sips -s format jpeg "$f" converts each file to JPEG.
- --out "${f%.*}.jpg" strips the original extension and appends .jpg.
Match Lower-Case Extensions
If your files use a lower-case .heic extension, change the pattern to *.heic. Shell file name matching is case-sensitive, so you need to match the exact case.
Resize Images During Conversion
Resize an image while converting by adding the -Z option followed by a pixel size. The -Z flag scales the longest edge to that number of pixels and adjusts the other edge to maintain the original aspect ratio.
For example, to resize the longest edge to 2048 pixels:
sips -s format jpeg -Z 2048 IMG_0001.HEIC --out IMG_0001.jpgCombine resizing with quality settings and batch processing:
for f in *.HEIC; do sips -s format jpeg -s formatOptions high -Z 2048 "$f" --out "${f%.*}.jpg"; doneEach HEIC file becomes a JPEG with a high quality setting and a maximum dimension of 2048 pixels.
Build a Reusable Script for Batch Conversion
Save The Command As A Script
Run the same conversion often? Save the command as a shell script. Create a text file named convert_heic.sh with the following content:
#!/bin/bash for f in "$1"/*.HEIC; do sips -s format jpeg -s formatOptions high -Z 2048 "$f" --out "${f%.*}.jpg" doneReplace the quality and size values with your preferred settings. Make the script executable with chmod +x convert_heic.sh, then run it by passing the folder path as an argument:
./convert_heic.sh /path/to/your/photosThis approach keeps your command consistent and saves typing.
Notes on File Extensions and Case Sensitivity
iPhone HEIC photos use an upper-case .HEIC extension. The shell pattern *.HEIC matches only files with that exact case. If you have a mix of cases, use a pattern that ignores case by enabling the nocaseglob shell option:
shopt -s nocaseglob for f in *.heic; do sips -s format jpeg "$f" --out "${f%.*}.jpg"; doneshopt is a Bash feature and may not work in other shells. Check the extension of your files before running a batch command.