Useful when you want to share in Github how a change in your code is working, or how to reproduce a bug. I use QuickTimePlayer to record the screen, then ffmpeg to convert the mov file to gif.
ffmpeg -i video.mov -r "15" video.gif
This example sets the frame rate to 15.
The output now can be uploaded to Github.