Disables Mac touchpad for a user-specified amount of time each time a key is pressed on the keyboard. This prevents accidental touchpad input (e.g. palm of hand moving over the edge of the touchpad) from being detected as a tap and causing the cursor to jump to a different line while the user is typing.
Download Latest Release | View All Releases
NOTE: Requires administrative privileges (sudo).
TouchGuard requires root privileges (sudo) to function. This is because it uses a low-level Event Tap (kCGHIDEventTap) to intercept keyboard and mouse events before they reach the window server.
Why sudo?
- Reliability:
kCGHIDEventTapis the most reliable way to intercept events globally, regardless of which application is focused. - Alternative: The alternative is using Accessibility permissions, which requires the user to manually grant permission in System Settings. However, for a LaunchDaemon that runs on boot,
sudois the standard and most robust approach.
Security Note: Since this application runs as root and intercepts all input events, you should only run it if you trust the source. The source code is available for review in this repository.
The easiest way to install TouchGuard:
curl -fsSL https://raw.githubusercontent.com/sirfifer/TouchGuard/main/scripts/quick-install.sh | sudo bashThis downloads and installs the latest version automatically. TouchGuard will start immediately and run automatically on boot.
To uninstall:
curl -fsSL https://raw.githubusercontent.com/sirfifer/TouchGuard/main/scripts/quick-uninstall.sh | sudo bashIf you prefer to download and install manually:
- Download the latest release: TouchGuard-v1.5.0-macos.tar.gz
- Extract the archive:
tar -xzf TouchGuard-v1.5.0-macos.tar.gz cd TouchGuard-v1.5.0-macos - Install:
sudo ./install.sh
TouchGuard is now running and will automatically start every time you boot your Mac.
To uninstall:
sudo ./uninstall.shAfter installation, you can easily adjust the time intervals or enable/disable features:
Change settings with a single command:
# Change time interval
sudo ./configure.sh --time 0.15
# Enable movement blocking
sudo ./configure.sh --block-movement
# Set different intervals for clicks and movement
sudo ./configure.sh --time 0.2 --movement-time 0.1
# Disable movement blocking
sudo ./configure.sh --disable-movementRun without arguments to be prompted for settings:
sudo ./configure.shView your current configuration:
./status.shThis shows:
- Service status (running/stopped)
- Current time intervals
- Movement blocking status
- File locations
- Recent logs
If you prefer to edit the configuration file directly, you can modify /Library/LaunchDaemons/com.syntaxsoft.touchguard.plist. After editing, restart the service:
sudo launchctl unload /Library/LaunchDaemons/com.syntaxsoft.touchguard.plist
sudo launchctl load -w /Library/LaunchDaemons/com.syntaxsoft.touchguard.plistIf you prefer to run TouchGuard manually without installing it as a system service:
# Make the binary executable
chmod +x TouchGuard/TouchGuard
# Run it (Terminal window must stay open)
sudo ./TouchGuard/TouchGuard -time 0.2Additional options:
-time <seconds>: Duration to disable touchpad clicks (default: 0.001)-blockMovement: Also block cursor movement (not just clicks)-movementTime <seconds>: Duration to block movement (defaults to-timevalue)-nodebug: Suppress debug messages-version: Display version information
Examples:
# Block clicks for 200ms
sudo ./TouchGuard/TouchGuard -time 0.2
# Block clicks for 200ms and cursor movement for 100ms
sudo ./TouchGuard/TouchGuard -time 0.2 -blockMovement -movementTime 0.1The time interval of 200ms (0.2 seconds) works well for most users. If you're still experiencing issues (cursor jumps while typing) or the trackpad feels unresponsive after typing, adjust the interval up or down as needed.
Build from source:
make buildRun tests:
make test # Run all tests
make test-install # Test installation scripts only
make test-cli # Test CLI behavior onlyThe project includes automated tests for:
- Installation script validity and plist configuration
- CLI argument parsing and version output
- Binary integrity and size checks
See CLAUDE.md for detailed testing information and development guidelines.
Original Author: Prag Batra (SyntaxSoft) Original Repository: https://github.com/thesyntaxinator/TouchGuard
This fork adds cursor movement blocking, installation scripts, and LaunchDaemon support for easier deployment. See CREDITS.md for full attribution.
For this fork: Open an issue at https://github.com/sirfifer/TouchGuard/issues
Original project: https://github.com/thesyntaxinator/TouchGuard/issues or email syntaxsoftsupport@icloud.com
Original project: https://github.com/thesyntaxinator/TouchGuard/issues or email syntaxsoftsupport@icloud.com
We welcome contributions! Please see CONTRIBUTING.md for details on how to submit pull requests, and CODE_OF_CONDUCT.md for our community standards.
This project is licensed under the MIT License - see the LICENSE file for details.