ImageOptim-CLI: Unable to install on M1 / Apple Silicon

Steps To Reproduce The Error

Try to install the package on an M1 Mac.

Expected Behaviour

Install as per normal.

Actual Behaviour

It runs into issues with node@10, as shown in this output:

Warning: node@10 has been deprecated because it is not supported upstream!
Error: node@10: no bottle available!
You can try to install from source with:
  brew install --build-from-source node@10
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.

Building node@10 from source does not work.

It results in this output:

==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/manifests/69.1
Already downloaded: /Users/jonathan/Library/Caches/Homebrew/downloads/319330d53dab436f7e6bbe478539f29d41abb6be79788b06615f28006a82b30c--icu4c-69.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/blobs/sha256:25a1ec460d422ba5abff15dc5cb60ad36003ad021585fa7be278d1dca6fcd2c4
Already downloaded: /Users/jonathan/Library/Caches/Homebrew/downloads/ccf6b67f22944e4ef3d02f6108f71d827eb5193bfeb2a23b10a3471f43e79874--icu4c--69.1.arm64_big_sur.bottle.tar.gz
==> Downloading https://nodejs.org/dist/v10.24.1/node-v10.24.1.tar.xz
######################################################################## 100.0%
Warning: node@10 has been deprecated because it is not supported upstream!
==> Installing dependencies for node@10: icu4c
==> Installing node@10 dependency: icu4c
==> Pouring icu4c--69.1.arm64_big_sur.bottle.tar.gz
🍺  /opt/homebrew/Cellar/icu4c/69.1: 259 files, 73.3MB
==> Installing node@10
==> ./configure --prefix=/opt/homebrew/Cellar/node@10/10.24.1_1 --with-intl=system-icu
Last 15 lines from /Users/jonathan/Library/Logs/Homebrew/node@10/01.configure:
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_promise_internal_field_count': 1,
                 'v8_random_seed': 0,
                 'v8_trace_maps': 0,
                 'v8_typed_array_max_size_in_heap': 0,
                 'v8_use_snapshot': 'true',
                 'want_separate_host_toolset': 0,
                 'xcode_version': '12.0'}}
creating config.gypi
creating config.status
creating config.mk
running:
    python tools/gyp_node.py --no-parallel -f make-mac
Error running GYP

Do not report this issue to Homebrew/brew or Homebrew/core!

Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels.

Version Numbers or N/A

  • macOS: 11.5.2
  • /Applications/ImageOptim.app: 1.8.8
  • /Applications/ImageAlpha.app: 1.5.1
  • /Applications/JPEGmini.app: (not installed)

Help Needed

Is there any way around this? Is there a way to run ImageOptim-CLI on an M1 Mac?

What are the options?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 10
  • Comments: 24 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I’m currently getting the same error with the brew install

imageoptim-cli: The x86_64 architecture is required for this software.

@sammcj, which part of the issue “Unable to install on M1 / Apple Silicon” you think is not closed/resolved?

Feel free to open a new issue if you want.

And have you visited the linked issue? It seems like you’re not really reading what I wrote, nor understanding what is really the issue at hand. And given your attitude I’ll refrain from commenting here further.

@inspiredearth @matthewferry @jwryan9 @shuguenot @sebastienbarre I have updated the version of node.js which imageoptim is built with to 12.18.2, hopefully this will solve this issue.

This is in imageoptim-cli@3.0.7 which has just been released, it might take some time before it appears on homebrew (I don’t control that).

Also don’t work for me:

> brew install imageoptim-cli
imageoptim-cli: The x86_64 architecture is required for this software.
Error: imageoptim-cli: An unsatisfied requirement failed this build.

maybe this should be reopen?

Friendly bump: We’re ~9 months on since last activity here, but this is still an issue.

When I attempt to brew install imageoptim-cli on Apple Silicon (M2), I get the message:

$ brew install imageoptim-cli
[…snip…]
imageoptim-cli: The x86_64 architecture is required for this software.
Error: imageoptim-cli: An unsatisfied requirement failed this build.

The version pulled down by yarn seems to run fine:

$ yarn add imageoptim-cli
[…snip…]
✨  Done in 0.50s.

$ node_modules/imageoptim-cli/dist/imageoptim --version
3.0.7

What, specifically, are the blockers to updating the homebrew formula?

@sammcj, I know you’re confused, but this issue is about installing on Apple Silicon, not running it natively. People above showed that it can be installed, so indeed this issue is resolved.

The comment I made is about the brew formula. The maintainer here tried to fix it, but clearly wasn’t very familiar with homebrew. And technically it is an issue for homebrew, not this repo (homebrew formula are individually maintained, sometimes by the same developer of the software, but most of the time not, as in any other package index.)

Regarding running it natively, probably you should worry more about this issue: https://github.com/ImageOptim/ImageOptim/issues/334

Lastly, it is easy to ask for people to “just recompile for arm64”. But remember this is all free softwares developed by people in their free time and volunteer to release it with an open source license. Most these licenses come with a clause saying that the software has no warranty. They have no obligation at all to do those volunteer work. So just be nice and stop behaving like a consumer.

Thanks.

I just cloned the repo to test it out manually.

  • I tried the old 3.0.2, and indeed it failed at yarn install, same error as seen with Homebrew. What I didn’t realize is that yarn build does work and produces a binary, but since the previous step failed, Homebrew had already given up.
  • I then switched to the 3.0.7 tag you just released, and yarn install now succeeds (and so does yarn build). So this is looking good for Homebrew, thanks for fixing that.

Also don’t work for me:

> brew install imageoptim-cli
imageoptim-cli: The x86_64 architecture is required for this software.
Error: imageoptim-cli: An unsatisfied requirement failed this build.

maybe this should be reopen?

Ask far as I’ve understood from the responses to this thread (started be me), it was determined (here) that since it can be installed if Homebrew is installed in Rosetta mode, the issue is resolved.

I have been using Homebrew for a few years in native Silicon mode, and having to reinstall my Homebrew and all packages (in Rosetta mode) seems like too much hassle just to get imageoptim-cli working. So I’ve moved on from trying to use imageoptim-cli via Homebrew.

I understand from comments in this discussion that we can install Yarn (a Javascript package manager) via Homebrew (or via Shell script), and then install imageoptim-cli with yarn. I’ve not yet tried that.

@ickc that’s a bit petty / high and mighty, I’m an OSS maintainer as well. While I appreciate what you’re saying in general - I didn’t like a consumer - I just stated that it’s not fixed and needs to be compiled for ARM plain and simple 🤷

@Spomsoree, if you follow https://github.com/Homebrew/homebrew-core/pull/96368 then you’ll see the patch isn’t accepted, and is made under the assumption that you can run it through rosetta 2.

So in short, it can’t be run native yet, but you can run it through rosetta 2. In order to do this, follow https://github.com/Homebrew/brew/issues/9173

Yep.

image

@janosh yes, runs without issue.

$ imageoptim --imagealpha --quality 0-100 --number-of-colors 32 example.PNG
i Running ImageAlpha...
i Running ImageOptim...
âś“ example.PNG was: 474kB now: 47.7kB saving: 426kB (89.93%)
âś“ TOTAL was: 474kB now: 47.7kB saving: 426kB (89.93%)
âś“ Finished

$ which imageoptim
/Users/levi/.npm-global/bin/imageoptim

$ ls -lah /Users/levi/.npm-global/bin/imageoptim
lrwxr-xr-x 1 levi staff 54 Feb 15 12:52 /Users/levi/.npm-global/bin/imageoptim -> ../../.config/yarn/global/node_modules/.bin/imageoptim*

$ arch
arm64