How to Fix a Mac Keyboard Input Lag When Coding
Tags: webdev
Published: 2021-04-29 09:24:09

Coding is anything but easy; throw a keyboard input lag into the mix and a challenging task quickly turns into an ordeal. 

How laggy is too laggy when it comes to coding? While you can live with a 5-10 milliseconds keyboard delay, a 30 milliseconds lag shouldn’t be tolerated. Bearing that in mind, let’s delve into some simple ways to fix this frustrating issue. 

## Magic or wireless keyboard fix
If you’ve noticed an input lag when coding, your Magic or wireless keyboard might be to blame. Try [re-pairing the keyboard](https://www.macworld.co.uk/how-to/fix-bluetooth-mac-3682642/) with your Mac to get rid of its delayed response:

1. In the Bluetooth Preferences menu, select your keyboard and click X
2. In the window that opens, click Remove
3. Turn off the keyboard, then turn it back on 
4. In the Bluetooth Preferences menu, select your keyboard and click Set up Bluetooth keyboard
5. Follow the on-screen instructions to re-connect the keyboard with your Mac
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ph5kdee77ez5i5nkzs64.png)

## Reset the Bluetooth module
As the keyboard’s battery power runs low, you might notice a keyboard input lag when coding. Before going any further, charge or replace the dying battery, and check if this helps improve the keyboard response. Still no luck? Try resetting the Bluetooth module:

1. Go to the Apple menu and select System Preferences
2. In the Bluetooth menu, check the box titled Show Bluetooth in the menu bar 
3. Click the Bluetooth icon while holding the Shift + Option keys
4. In the drop-down menu, select Reset the Bluetooth Module
Reconnect the keyboard with your Mac

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cb7bwfqa8qnr4h304ofn.png)

## Update your coding editor 
The keyboard response delay might disappear after you update your coding editor. Whether it’s Atom, Xcode, Visual Studio or any other coding editor, you are likely to notice a typing speed boost. If it fails to materialize, consider switching your code editor. 

##Reset the SMC and NVRAM
Another possible way to eliminate the delayed keyboard response might be a bit more time-consuming. However, if you’ve read this far, you probably have enough perseverance to fix the issue regardless of how long it takes. So let’s do just that. 

You can [reset the SMC and NVRAM](https://www.macworld.com/article/224955/how-to-reset-a-macs-nvram-pram-and-smc.html) of your Mac to try to remove any annoying keyboard delay. This troubleshooting trick can be helpful in more ways than one, so keep it in mind if a misbehaving Mac disrupts your coding session again. Better yet, optimize and [speed up your Mac](https://mackeeper.com/blog/how-to-speed-up-a-slow-mac/) to ensure the issue doesn’t disrupt any coding sessions in the future. 

## Disable Slow Keys 
Misconfigured keyboard settings are a common cause of a typing lag on Macs. Fortunately, it doesn’t take much effort to fix the issue and improve your coding experience. To [speed up the keyboard](https://support.apple.com/en-ie/guide/mac-help/mchlp2264/mac) response of your Mac, follow these simple steps:

1. Go to the Apple menu and select System Preferences
2. In the Accessibility menu, select Keyboard
3. In the Hardware tab, uncheck the Enable Slow Keys box

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o08gmu3y6rqeaddzaphx.png)

## Tune-up Big Sur
It’s not uncommon for Mac users to experience keyboard delay after upgrading to Big Sur. If you run into this issue immediately after introducing the new macOS to your Mac, you know who’s to blame. To get rid of the typing response time, toggle off Automatic Graphic Switching in the Battery section of System Preferences. You can also try creating a new user, or booting in [Safe mode](https://support.apple.com/en-gb/guide/mac-help/mh21245/mac) if the issue persists. 


Hopefully, my tips have helped you address any issues and you won’t have to put up with a single iota of keyboard input lag anymore. Let me know which tip was particularly useful in the comments box below.