Apple - How to "killall" Visual Studio Code in Terminal?

I have Visual Studio Code, version 1.1.1, installed and on my system the following works for me:

kill -9 $(pgrep Electron)

Update: Just tested with Visual Studio Code, version 1.14.1, under macOS 10.12.5 and the above command closes Code and Code Helper that show in Activity Monitor.

PS: killall Electron also works.

Alternative for Mac OS (Darwin) is:

osascript -e 'quit app "Visual Studio Code"'

  • use Activity Monitor to get the process id of "Code" ( -> PID)
  • run ps -ef | grep PID to get the process name as known to the OS
  • run killall <process name>