IsoHappy
Menu

Command line

IsoHappy can run without a window, from Terminal or a script. This is useful for working through many images, for automation, or for long imaging runs on a server Mac. Most people never need it.

Start it

The program is inside the app:

/Applications/IsoHappy.app/Contents/MacOS/IsoHappy --cli --image disc.iso --checksums --json report.json

--cli starts the command line. --help (or -h), --version, --version-number and --list-drives also work without it. Run --help to see every option, its choices and the exit codes for the version you have. The reference that --help prints is always the most accurate list, and it is in English on every system language so scripts can rely on it.

How options are read

Parsing is strict. Nothing is processed when there is:

  • an unknown option, or a missing value,
  • a value that is not one of the listed choices (choices ignore upper and lower case),
  • an option given twice (an alias such as -i counts as the same option),
  • a combination that cannot mean what was asked, for example image options without --create-image.

A value may follow its option, or be attached to a long option with =, as in --json=report.json. A value that starts with - must be attached: --match=-draft*. Short forms such as -i cannot take an attached value. Only --image, --span, --drive, --match and --remap may be repeated.

Information

OptionWhat it does
--helpPrints the reference and stops.
--versionPrints IsoHappy <version> (<build>).
--version-numberPrints the version as a number, so 1.2.3 prints 10203, for integer comparisons in scripts.
--list-drivesPrints a JSON list of drives: index, bsdName, deviceNodePath, model, media, totalBytes, sectorSize, removable, writable, wholeDisk, optical, empty.
--tocPrints the sessions, tracks (mode, start, length, ISRC, CD-Text) and volumes, and adds the layout to the JSON report.

Inputs

  • --image <path> (or -i) opens a disk image, an optical image, a container such as a virtual disk, forensic image or compressed file, or a /dev/diskN device node.
  • --span <path> names one piece of a split image. Give two or more, in order, and they open as one image.
  • --drive <index or diskN> opens a drive by its --list-drives number, its BSD name or its /dev path.

Several inputs can be given in one run. They are processed one after another: images, then the span, then drives. A failed input does not stop the others.

For --image and --span you can force how a file is read: --sector-size, --header-bytes, --byte-offset and --byte-length (open only part of the file), --zip-member, --wrapper, --raw-bytes (ignore container formats) and --pad-last-sector. These match Open Image with Options.

For every input:

  • --no-explore opens it as one unexplored area, as File > Open Without Exploring… does: its size and tracks are known, but no partition or file system is read. Use it with --toc, --readability-check, --checksums, --json, --create-image, --managed-image, --managed-empty, --clone-to or --sector-ranges. It cannot be combined with extraction, scans, file reports or a session, track, partition or file system selection.
  • --remap <lba>:<skip> reads through a read remapping rule, for discs whose data was shifted by a mastering fault: from sector lba on, every read moves skip sectors further on, or back with a negative number. Repeat it for more rules (up to 256). With remapping, an image’s or disc’s own track list is not used.

Choose what to work on

  • --session, --track, --partition and --filesystem choose volumes. --track takes one track number, several separated by commas (--track 1,3), audio for every audio track, data for every other track, or all; with --create-image, --track must name one track number (or all). File system codes are the lowercase names --toc prints, such as iso9660, joliet, udf, fat32, exfat, ntfs, hfsplus, apfs or ext.
  • --path picks one folder or file, starting with /. An exact name is used first; otherwise a name that differs only in upper and lower case is used when there is exactly one.
  • --match picks files (never folders) whose name matches a wildcard pattern, or whose full path matches when the pattern contains /. * stands for any run of characters and ? for one; square-bracket classes work too. Matching ignores upper and lower case, so *.jpg also finds PHOTO.JPG.
  • --path and --match need --extract or --report.
  • --first-sector with --sector-count or --last-sector gives a block range, for --create-image, --clone-to, managed image completion, --deep-scan and --readability-check.

A selection that matches nothing, or a range outside the source, ends the work on that input with its own exit status (see Exit status), so a script can tell what was missing. For a session, track, partition or file system, the message names what does exist.

Scans

OptionWhat it does
--carveFinds files by signature, and orphaned file records. --carve-if-empty runs it only when no file system was found. --carve-types, --carve-max-size and --carve-rule-order change the scan for this run.
--deep-scanLooks for lost file systems, orphaned records and files (see Find Lost). --deep-scan-if-empty, --deep-scan-methods and --deep-scan-unallocated change it.
--save-scan, --load-scanSave scan results, or load results saved earlier for the same input.
--readability-checkReads every sector of the source or range and prints Unreadable sectors: N. The JSON report has the count and the first 1,000 unreadable ranges.
--entropy (or --anomalies)The entropy and metadata review.
--checksums (or --hash)MD5, SHA-1 and SHA-256 of the source.

Reading damaged media

--retries, --block-retries, --retry-pause, --read-timeout, --reverse-chunk, --no-single-sector-fallback, --retry-reduction, --slow-on-errors and --strictness set the read policy for this run (see Read errors and surface scans).

--on-read-error says what happens to a sector that still cannot be read: zero, omit, pattern:<text>, hex:<bytes>, valid-raw and erroneous-raw (raw CD images only), abort, retry or ask. With retry, IsoHappy gives up after 100 rounds.

With ask, each failure is printed on standard error and one answer is read from standard input: r (retry), i (ignore this one), a (ignore all) or s (stop). Any other answer stops. What “ignore” writes is set with --ask-ignore-action, zero fill by default. When standard input ends, the answer is stop. A stop, or the abort action, ends the work for that input with status 6.

Options you do not give keep the values from the app’s Settings. Nothing a command-line run sets is saved to Settings.

Retries, pauses and time limits have not been tested against a physically damaged disc in an optical drive.

Extract files

  • --extract <folder> saves the selection: the chosen volumes, the --path folder or file, or the --match files with their folders. --extract-all <folder> saves every volume and takes no selection options.
  • --existing decides what happens to an item that already exists: refuse (the default; the folder must then be new or empty), rename, skip or overwrite. With overwrite, the old item is moved to the Trash once the new one is complete, or deleted if it cannot be moved to the Trash.
  • --name-template names the folder of each volume, from {n} (three-digit volume number), {volume}, {fs}, {session}, {track}, {partition} and {image}. The default is {n}-{volume}.
  • Characters a Mac file name cannot hold (/, : and NUL) are always replaced, by _ or by the character given with --name-char (one character, which cannot be one of / : \ * ? " < > | ., a space or a control character). --windows-names also replaces the characters Windows file names cannot hold (\ * ? " < > | and control characters) and trailing dots and spaces, for a drive a Windows PC will read. Items renamed while extracting (for these characters or because a name was already taken) are counted as renamedItems in the recovery entries of the JSON report.
  • --mac-format stores Mac resource forks and Finder information as native, appledouble, applesingle or macbinary. Without it, the format set in Settings is used.
  • --no-streams, --no-timestamps, --timestamps, --no-permissions, --no-file-flags, --add-type-extensions and --no-sparse change what metadata is written (see Save files).
  • --extract-mode xa writes each selected file’s Mode 2 sectors as 2336-byte XA sectors, and --extract-mode mpeg writes the MPEG video with the extension .mpg. Both need an image that keeps raw sectors.

Images, clones and managed images

  • --create-image <file> saves the whole source, or the chosen session, track, partition or block range. --image-mode picks user, raw, raw-to-user, xa, wav or sectors, and the file extension follows the mode. --separate-tracks, --cue, --split (in megabytes of 1,000,000 bytes), --md5 and --no-md5 match the Create Image sheet.
  • --managed-image <file> creates a managed image (.ibp and .ibq); --managed-empty creates one with every sector unread. --paranoid and --managed-part-size match the Settings.
  • With a managed image open as --image, --complete-from <file> or --complete-from-drive <index or diskN> reads its missing sectors, with --completion gaps, end, both (the default) or loop (and --passes for loop), and --allow-layout-mismatch. --finish-dummy fills every sector still unread with zero, valid-raw, pattern:<text> or hex:<bytes> so other tools can open the .ibq file. See Managed images.

Clone onto a disk

--clone-to <diskN> writes the whole source, or the block range, onto a disk or partition, erasing it. It makes a plain copy; managed copies with a state file are only available in the window. Because this destroys what is on the target:

  • It always needs --confirm-overwrite with the same disk name: --clone-to disk4 --confirm-overwrite disk4.
  • IsoHappy only writes to external drives and cards. It refuses any disk built into your Mac (including the startup disk and its recovery and firmware containers), a disk with a mounted volume, the source itself or a disk that holds the source image, a partition inside the source, a read-only disk, a disk that is too small, and a disk it does not know. No option overrides these. A refused target ends the work on that input with status 2.
  • A disk that holds BitLocker or LUKS data also needs --confirm-encrypted-target, and a warning is printed.
  • macOS may ask for an administrator’s approval.
  • --verify and --no-verify choose whether the disk is read back afterwards.

Writing has been tested on disk images attached without mounting, not on a physical USB drive or card.

Optical drives

A drive is opened the way the buttons on its details page in the window open it:

  • --drive-read optical reads a disc with the optical drive commands (its table of contents, whole raw sectors, CD-Text), and --drive-read device opens it as a plain device. Without it, the Read discs with optical drive commands setting decides.
  • --drive-exclusive opens the disc with exclusive access, reading past the end it reports; add --drive-pregap to include the 150 sectors before the first track of a CD (all sector numbers then move up by 150). These do not fall back to a plain device: if the drive refuses, the input fails.
  • --save-drive-layout <file> saves the sessions and tracks read from the disc to a new file, and --drive-layout <file> reads another disc with that saved layout (the window’s Open With Remembered Layout). Use it only when the two discs share a layout. --drive-layout cannot be combined with --drive-exclusive.
  • Retry counts kept for the drive in its details in the window replace the Reading settings’ counts for that drive; giving --retries or --block-retries turns the drive’s own counts off for the run, and a count you do not give then comes from the Reading settings.

These drive options need --drive, and were tested with simulated drives (recorded discs and a disk image attached as a device), not with a physical optical drive.

--drive-speed <n or max> sets the read speed before reading, --close-tray closes an empty drive’s tray first and waits up to a minute for the disc, and --eject-after ejects the disc at the end. These need an optical drive and have not been tested on a real drive yet.

Reports

OptionWhat it writesLicense
--json <file>Volumes, digests, entropy, review indicators and the result of every step that ran. One combined file for all inputs; it is not written when every input failed.Free
--csv <file>A list of every file, folder and stream (format below).Pro
--dfxml <file>A DFXML report.Pro
--report <file>A report of the selection: --report-kind list (the default), tree, xml, dfxml, csv or unreadable, or --report-template <file> with a template saved from the app. --report-encoding picks utf8, utf8-bom, utf16le, utf16le-bom, utf16be, utf16be-bom or ascii. See Reports and file lists.Pro
--sector-ranges <file>Sector ranges: --ranges readable, unreadable (the default), unread or all, from what this run read. Add --readability-check to read every sector first.Pro

CSV format

The CSV file is UTF-8 with a header line and one row per file, folder and stream, covering the whole source:

Path,Name,IsDirectory,Size,StartLBA,SectorCount,FileSystem,Carved,Deleted,MacType,MacCreator

Size is in bytes; StartLBA and SectorCount are in sectors of the image. IsDirectory, Carved and Deleted are true or false. FileSystem holds the file system’s display name, such as ISO 9660. MacType and MacCreator are four-character Finder codes, empty when the file has none. Text cells are quoted with " (a " inside is doubled), and a cell that starts with =, +, -, @, a tab or a carriage return gets a leading ' so spreadsheets do not run it as a formula. These columns and their order will not change; new information goes into other reports.

Open an image in the window

--open-sector <lba> with one --image hands the image to the IsoHappy window as an isohappy:// link, which opens it at that sector after you confirm, and exits. It works only for single-file images, the same as links: never cue sheets or other descriptors, virtual disks, forensic or split image sets, devices, network paths or folders. The command line checks this first and exits with status 1, naming the reason, when the window would refuse the image. Options that do work, such as extraction or reports, cannot be combined with it.

Progress and status files

  • --progress-file <file> keeps a small JSON record (input, inputs, source, stage, fraction, status, updated) in the file, rewritten every half second while the run works. The file must not exist beforehand. Progress is not printed to the terminal.
  • --exit-code-file <file> writes the exit status when the run ends, as {code} {meaning} or the text given with --exit-code-format.

Output rules

  • Existing files and folders are never replaced. Every output path must be new, its folder must exist, and the extraction folder must be new or empty (unless you give --existing). This is checked before the first input is opened.
  • Before a volume is extracted, IsoHappy adds up what it would write and compares it with the free space at the destination. If there is not enough, that volume is not extracted and the message says how much is needed and how much is free. Give --skip-space-check to extract without this comparison, only when you know the destination reports its free space wrongly; a destination that fills up still stops the extraction with an error.
  • With several inputs, CSV, DFXML, report, image and other file paths get -001, -002 added, and extraction uses folders named image-001, image-002, so inputs with the same name never collide.
  • Warnings and errors go to standard error; errors are listed at the end of the run. Reports go only to the files you name. --toc, --list-drives and --readability-check also print to standard output. --no-warnings stops warnings from being printed (errors are still printed, and warnings the JSON report records stay in it).
  • Command-line runs never save the automatic Files with Read Errors report the window saves; they write only the reports you ask for.
  • A file whose data lies partly or wholly past the end of the image is never written. Zeros are only written in place of a sector that is part of the image but could not be read.
  • An extraction that finds no files at all is a failed input, not an empty success, and the empty folders it created are removed.
  • A recovery that needs review still leaves its files on disk. Check the messages and the JSON report before relying on them.

Licenses

The command line uses the license activated in the app on the same Mac, and follows the same rules as the window (see Licenses):

  • Free: listing, --toc, JSON reports, checksums, entropy, readability checks, carving and deep scans with the built-in rules.
  • Personal: images, clones, managed images and their completion, saving and loading scans, --extract-mode xa and mpeg, and extraction from file systems that need Personal.
  • Pro: an image of a block range, CSV, DFXML, --report, --sector-ranges, Mac formats and streams in extraction, and carving or deep scans when you have added custom rules.

Before a run that processes inputs, IsoHappy checks the saved license with the license server if a connection is available. Paid features work offline for 30 days after the last successful check. If they stop, open IsoHappy while online and choose Refresh License.

Exit status

0 means every step finished, every volume was listed completely and every saved file was complete. Any other value means something did not fully succeed, and the reason is printed to standard error. When several apply, the lowest value other than 0 is reported.

ValueMeaning
0Success.
1Invalid arguments, an output that cannot be used, a license refusal, or an image --open-sector cannot hand over. This replaces every other value.
2An input could not be opened or processed (including a refused clone target), or an extraction found no files in it.
3--carve, --deep-scan or --load-scan did not finish for at least one input.
4Finished, but some output needs review: filled with zeros, unchecked (files found by --carve always are) or skipped, an image with unreadable sectors, an incomplete file listing, or a --readability-check that stopped before reading every sector.
5The folder or file --path names does not exist, or no file matches --match.
6A read error stopped the work (--on-read-error abort, or the answer was stop), including while imaging or cloning.
7--readability-check found unreadable sectors (the count is in the JSON report).
8The session --session asks for does not exist.
9The track --track asks for does not exist, or no track is of the kind it asks for.
10The partition --partition asks for does not exist.
11No volume of the file system --filesystem asks for was found.
12The drive --drive or --complete-from-drive names does not exist.
13The sector range is outside the source.

A --create-image session, track or partition that is the whole source is also reported with 8, 9 or 10; leave the option out to save the whole source.

The number of unreadable sectors or of files that need review does not fit in an exit status; read it from the JSON report, or for --readability-check from standard output (Unreadable sectors: N).

Check --help for the values in your version.