Download WakaTime for Mac.
Move WakaTime.app into your Applications folder, and run WakaTime.app.
If prompted, enter your API Key then click Save.
Use your mac like normal and your coding activity will be displayed on your WakaTime Dashboard.