imageoptim-cli: x86_64 architecture required (Apple silicon)
Fix Homebrew's "The x86_64 architecture is required for this software" error for imageoptim-cli on Apple silicon: check your shell, then try the npm route.
TroubleshootingUpdated 5 min read
On this page
You ran brew install imageoptim-cli on a Mac with Apple silicon and got this:
imageoptim-cli: The x86_64 architecture is required for this software.Your Homebrew setup is most likely fine. The package asks for an Intel machine, and Homebrew checks that before it installs anything.
Why Homebrew says the x86_64 architecture is required
Homebrew packages can declare the hardware they run on. Homebrew's Formula Cookbook lists depends_on arch: :x86_64 among its examples of dependency declarations. The Cask Cookbook documents the same arch: key for casks, where :x86_64 means 64-bit Intel and :arm64 means Apple Silicon. It also says the requirement is checked when you try to install, which is why you only see the error at that point.
The likeliest cause is that the imageoptim-cli package carries an Intel-only declaration. We can't see its current definition from here, and we don't know whether it has changed since the error was last reported on the project's GitHub issue tracker in March 2025. Homebrew's docs also don't say whether it is a formula or a cask. Run brew info imageoptim-cli to see what your Homebrew currently says about it.
A second, less common cause is the shell you run it in. Homebrew's Common Issues page covers Apple silicon Macs that end up with both /usr/local and /opt/homebrew installations active, for example after a Migration Assistant transfer or when using an x86_64 terminal. That mix-up produces confusing behavior in general. On its own it wouldn't explain a package that is declared Intel-only.
| Cause | Symptom | Fix |
|---|---|---|
| Package declared Intel-only | Error appears in a native arm64 Terminal | Use the npm route below |
| Terminal running under Rosetta | uname -m prints x86_64 on an M-series Mac | Open a normal Terminal window, not one set to open using Rosetta |
| Leftover Intel Homebrew | brew --prefix prints /usr/local on Apple silicon | Follow Homebrew's Common Issues page before removing anything |
Check which architecture your shell uses
Run this first. It only reads information.
uname -marm64 means a native Apple silicon shell. x86_64 means an Intel Mac or a Terminal running under Rosetta.
Homebrew's Common Issues page also suggests checking these three:
arch
command -v brew
brew --prefixOn an Apple silicon Mac in a native shell, you would normally expect arm64 and a Homebrew prefix of /opt/homebrew. If you see /usr/local here, an old Intel Homebrew is in the way. Read the Common Issues page before you delete anything, because it advises recording the old install's packages first.
Fix: install the ImageOptim app, then the CLI through npm
People on the ImageOptim-CLI issue tracker report this workaround: install the Mac app, then install the CLI through Node. The CLI is a command-line front end for the ImageOptim app, so you need both. We haven't tested these steps ourselves, and you can verify each one as you go.
Download the ImageOptim app from its official site, imageoptim.com, and move it to Applications.
Open the app once so macOS registers it.
Check that Node is installed:
bash node --versionIf you get "command not found", install Node first. With Homebrew that is
brew install node.Install the CLI globally:
bash npm install --global imageoptim-cliCheck that the command is found:
bash imageoptim --help
To undo the install, run npm uninstall --global imageoptim-cli.
If npm fails with a permissions error
Symptom: EACCES: permission denied during the global install.
Cause: npm is trying to write to a folder your user account can't change. This usually happens when Node was installed in a system location.
Fix: don't use sudo. Install Node through Homebrew (brew install node) or a Node version manager, open a new Terminal window and run the npm install command again.
If imageoptim is "command not found" after installing
Symptom: npm reports success, but Terminal doesn't find the command.
Cause: npm's global bin folder isn't on your PATH, or Terminal hasn't picked up the change yet.
Fix:
- Quit and reopen Terminal, then run
imageoptim --helpagain. - Run
npm prefix -g. The command lives in thebinfolder inside the path it prints. - Add that
binfolder to yourPATHin~/.zshrc, then open a new Terminal window.
If the command runs but doesn't optimize anything
Symptom: imageoptim starts, but no files change or it can't reach the app.
Cause: the CLI depends on the ImageOptim app being installed, and a missing or broken app install is the likeliest reason. We don't have documentation on its exact behavior, so treat this as a thing to check, not a known fix.
Fix: confirm the app is in Applications and opens normally on its own. Then try the command on one copy of a test image, not your originals.
Checklist before you try again
uname -mprintsarm64in the Terminal you are usingbrew --prefixprints/opt/homebrewif you use Homebrew- The ImageOptim app is in Applications and opens
node --versionprints a version- You ran
npm install --global imageoptim-cli, not thebrewcommand - You opened a new Terminal window after installing
If nothing works
The CLI is maintained as an open-source project, so the project's GitHub issue tracker is the place to ask. Include:
- Your macOS version and the output of
uname -m - The output of
brew --version,brew --prefix,brew info imageoptim-cliandnode --version - The full output of the failing command, not just the last line
- Whether the ImageOptim app is installed and opens
Subject: imageoptim-cli install fails on Apple silicon
macOS version: (your version)
Mac: Apple silicon, uname -m prints arm64
Command: brew install imageoptim-cli
Error: imageoptim-cli: The x86_64 architecture is required for this software.
Tried: npm install --global imageoptim-cli after installing the ImageOptim app
Result: (paste the full output here)Common questions
Is this an error in my Homebrew install?
Usually not. The message says the package requires an Intel machine, and Homebrew enforces that when you try to install. Run brew doctor if you also see other warnings, but this message alone doesn't point to a broken setup.
Will the npm version work on Apple silicon?
Users on the issue tracker report that it does. We haven't tested it, and the result depends on the ImageOptim app the CLI drives, so try a few copies of files first.
Do I need Rosetta?
Only if the ImageOptim app you installed is Intel-only, which we couldn't confirm for the current version. macOS typically offers to install Rosetta the first time you open an Intel-only app.
Can I make Homebrew install it anyway?
We don't recommend it. An Intel copy of Homebrew on an M-series Mac leaves installs in both /usr/local and /opt/homebrew, which causes its own problems. Use npm instead.