ScreenFlow, a great pro product for macOS, outputs great animated GIFs (just turn off dithering!), with control over framerate, final scaling, etc.
And you can decide any time whether a video or a GIF would suit you best (or both, for different needs).
(Just a happy customer.)