git clone https://github.com/etherdev12/macos-keylogger.git
cd macos-keylogger
go build
./macos-keylogger ~/key.log
Note
You'll need to enable permission by going to System Settings > Privacy & Security > Accessibility and
enabling whichever terminal application you'll use to run this.
The root privileges might be required to run a keylogger.