You can record your screen with QuickTime and then convert that MOV file into a GIF.
Open QuickTime and click on the "File" menu then "New Screen Recording".
Drag your pointer to select the region of the screen you want to record, and then click the Start Recording button within the region.
When you're finished, stop recording. To stop recording, click the stop button in the menu bar. Now, go back to "File" menu and click "Export".
Save your screen recording as a movie.
Next, you can use Photoshop to open your screen recording and export it as a GIF.