Apple - Disable Command-W in the terminal

To disable W in Terminal, do the following:

  • From the  menu in the top left corner of the screen, select System Preferences. Click on Keyboard then Keyboard Shortcuts then Application Shortcuts. enter image description here

  • Click the + button to add a new shortcut

  • Select "Terminal.app" for the application, and for the command, type Close Window (this is case sensitive). In the shortcut box, give it a different shortcut, like ControlW enter image description here

  • Now W will not close your terminal windows.


You can set a prompt before closing in the preferences:

Terminal Preferences → Settings → Shell

enter image description here


I tried all of the above, and none worked for me.

What worked was changing the shortcut for the "Close" command.

enter image description here