Here is how I create and convert gifs on mac with free tools
Create a screen recording
Use the built in screen recording tool on mac to create a screen recording.
cmd + shift + 5
Select the screen area and click "Record".
When you are done, click the stop button in the menu bar at the top of the screen.
Convert the mov file to gif
You will need some tools for this. I assume you have homebrew installed.
brew install ffmpeg gifsicle
Then run the following command to convert the mov file to gif.
You must replace
<INPUT FILE> with the path to your mov file and
<WIDTH> with the width of the gif.
ffmpeg -i <INPUT FILE> -filter_complex "[0:v] fps=12,scale=<WIDTH>:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" output.gif | gifsicle --optimize=3 --delay=3 output.gif -o optimized-output.gif
You should have an optimised gif file in the same directory as the mov file.