How to Make an .ico File Using the macOS Terminal
Suppose you have an icon or logo at multiple resolutions and would like to combine them into a single favicon.ico
file for your website. These are the commands you need to get up and running from the comfort of your own terminal.
Step 1: install ImageMagick
Check out the ImageMagick downloads page for instructions on how to get it running on your machine. Personally, I like to use containerization to keep my Mac free from extraneous software that I rarely use, so I’ll install ImageMagick in a Docker container instead (make sure you have Docker installed):
This command will drop you into a bash
session on the container. From there, it’s easy to get ImageMagick installed:
ImageMagick has a dependency on tzdata
, so you will be prompted to configure your time zone upon installation. Since this is an ephemeral installation, you can just type 1
for each prompt to get through the installation process quickly.
Step 2: create the file
ImageMagick gives us a handy convert
command that makes the process super easy:
This will create the desired favicon.ico
file.
Step 3: verify the .ico file
ImageMagick also provides a nice utility called identify
for inspecting our file to ensure it is formatted as we expect.
The output should look something like this: