Closed inspiredearth closed 2 years ago
@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).
Thanks.
I just cloned the repo to test it out manually.
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. yarn install
now succeeds (and so does yarn build
). So this is looking good for Homebrew, thanks for fixing that.Tangential, but based on this pull request, it looks like imageoptim not being updated is blocking the homebrew formula from being updated.
What needs to be done to update the homebrew formula? Still seeing 3.0.2 and unable to install on Apple silicon https://formulae.brew.sh/formula/imageoptim-cli#default
I've not had any time to check but I suspect the package needs building for a different version of node.js than it is currently or it seems like maybe homebrew also supports linux now(?) and, if that's the case, could be related to this package being mac only.
https://formulae.brew.sh/formula/imageoptim-cli is now 3.0.7
but I still don't see support for Apple Silicon mentioned there, and of course it doesn't install:
imageoptim-cli: The x86_64 architecture is required for this software.
Error: imageoptim-cli: An unsatisfied requirement failed this build.
Installing via NPM is no different:
zsh: bad CPU type in executable: imageoptim
get the same as above for homebrew, but I was able to install imageoptim-cli
via Yarn without issue on Apple Silicon.
$ yarn global add imageoptim-cli
yarn global v1.22.17
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
success Installed "imageoptim-cli@3.0.7" with binaries:
- imageoptim
✨ Done in 5.25s.
Looks like the homebrew formula needs to be updated: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/imageoptim-cli.rb#L23
@levibuzolic Does it actually run after yarn
installation?
@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
@levibuzolic Thanks! Can you confirm that it's using Rosetta?
Yep.
Anything I need to do for this? I don't own an M1 Mac.
I'm currently getting the same error with the brew install
imageoptim-cli: The x86_64 architecture is required for this software.
@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
Similar issues to above, but with Yarn I get:
$ imageoptim --imagealpha --quality 0-100 --number-of-colors 32 example.PNG
zsh: bad CPU type in executable: imageoptim
$ which imageoptim
/Users/jason/.yarn/bin/imageoptim
$ ls -lah /Users/jason/.yarn/bin/imageoptim
lrwxr-xr-x 1 jason staff 54B 10 Oct 17:25 /Users/jason/.yarn/bin/imageoptim -> ../../.config/yarn/global/node_modules/.bin/imageoptim
$ arch
arm64
EDIT: turns out, I hadn’t installed rosetta yet – all good after this.
softwareupdate --install-rosetta
Just hit this problem as well - it's definitely not resolved @JamieMason.
Note - If you use it with Rosetta it'll run in emulation mode which is not efficient, the software needs to be compiled for ARM.
@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.
@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 🤷
@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.
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?
it looks like it is not installing the arm native artifact
imageoptim-cli
* Binaries built for a non-native architecture were installed into imageoptim-cli's prefix.
The offending files are:
/opt/homebrew/Cellar/imageoptim-cli/3.1.7/libexec/lib/node_modules/imageoptim-cli/dist/imageoptim
See this PR, https://github.com/Homebrew/homebrew-core/pull/135595 The build log is in here, https://github.com/Homebrew/homebrew-core/actions/runs/5437629545/jobs/9888363914
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?
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.
Yeah running software in emulation is a workaround/hack especially for something that's processor or GPU intensive, but I'm aware Jamie is doing a complete rewrite of imageOptim so probably isn't investing time in the current codebase.
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:Building
node@10
from source does not work.It results in this output:
Version Numbers or N/A
Help Needed
Is there any way around this? Is there a way to run ImageOptim-CLI on an M1 Mac?
What are the options?