PyGame is a collection of modules that break through the language of Python applications. These modules are designed to edit video games. PyGame, therefore, includes computer graphics and audio libraries created for the use and language of Python programs.
At first, open the Terminal which is located at Applications -> Utilities -> Terminal and make sure that the Python3 is installed in your system. If it is not installed then type the below command.
brew install python3
Installing dependency
XCode: The first step for PyGame is to install Apple’s Xcode program. In your Terminal app, enter and run the following command to install XCode.
xcode-select --install
Be sure to click on all the verification recommendations that require XCode
Installing PyGame
We can now install the latest version of PyGame. Type the following command in Terminal and press Enter.
pip3 install pygame
To test if PyGame has been installed on your Mac, open terminal and type python, and import pygame as follows
If you don’t see any errors, it means that PyGame has been successfully installed on your Mac.