How to fix the error OSError: ImageMagick binary cannot be found at /usr/local/bin/convert

How to fix the error OSError ImageMagick binary cannot be found at :usr:local:bin:convert

In some of your video / image creation Python scripts using the moviepy library, you may need the ImageMagick convert (or magick) binary.


What is the purpose of ImageMagick?

ImageMagick is a powerful software suite used to create, edit, compose, or convert bitmap images.

It can read, convert, and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, TIFF, and many others. ImageMagick is used to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses, and Bézier curves.

The primary binary associated with ImageMagick is called convert (in older versions of ImageMagick) or magick (in newer versions starting from ImageMagick 7). This command-line tool allows users to convert and manipulate images.


If you run your script and encounter the error OSError: ImageMagick binary cannot be found at /usr/local/bin/convert, follow those steps to fix the bug (disclaimer: this tutorial is for Mac users):

1° Download Homebrew if not installed on your Mac.


Head to https://brew.sh/ and follow the instructions to download and install Homebrew on your Mac, which will enable you to download and install ImageMagick.

Simply run the following command in your Mac Terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2° Download & Install ImageMagick

After installing Homebrew, in your Terminal, run the following command:

brew install imagemagick

This should solve the error.

You may also need to install FFMPEG on your Mac. You can use Homebrew.

brew install ffmpeg

Then check whether ffmpeg has been properly installed on your computer by running the following command in your Terminal:

ffmpeg -version

In some cases, you may also need to properly relink ffmpeg to ensure that Python can access it, again via the Terminal.

brew unlink ffmpeg
brew link ffmpeg

With both ImageMagick and ffmpeg properly configured, most of your bugs should now be resolved.

🚀 Subscribe to my weekly newsletter packed with tips & tricks around AI, SEO, coding and smart automations

☕️ If you found this piece helpful, you can buy me coffee