Caching imagemagick on macos containers

I’ve tried this - step two takes ~3 minutes and doesn’t seem to cache correctly.
The final step shows that the brew install command is correctly providing /usr/local/bin/convert

So, shouldn’t that file be restored correctly on subsequent runs?

  - restore_cache:
      name: "Restore ImageMagick Cache"
      key: image_magick_convert
  - run:
      name: "Install ImageMagick"
      command: "which convert || brew install imagemagick"
  - save_cache:
      name: "Save ImageMagick Cache"
      key: image_magick_convert
        - /usr/local/bin/convert
  - run: "which convert"

Are you sure that the only modified file is at /usr/local/bin/convert? Usually when one does an install, lots of operating system dependencies are added as well.

I wonder if the install command does a compile rather than just a binary fetch. If so, could you create a new build pipeline to create a new Docker image that inherits from your existing build image?

I’m certain there are other files. But that shouldn’t affect the cacheworthiness of this one file, right?

As an aside, I only need this one binary. As such, I was hoping that having just that file restored would work for me.

I should think it would cache, yes - it just wouldn’t work if you ran it. Can you try building in a temporary ls -l /usr/local/bin/convert after the cache restore?