6

I have a small shell script called "k" that i call everytime when i want to reset my complete Development Cycle:

killall node
killall Xcode
killall Terminal

How can i find out the final name of the "Visual Studio Code"-Prozess to kill it also this way?

I've tried:

killall "Visual Studio Code"

No matching processes belonging to you were found

killall "Code"

No matching processes belonging to you were found

Any ideas? I am looking for a generic approach without any manually lookup of PIDs necessary.

This application looks like this in Activity Monitor: enter image description here

8

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.

  • This is a pretty bad idea considering how many Electron apps exist now. A better plan would be to use $(pgrep Visual Studio Code). – DBrown Sep 10 '18 at 0:48
  • 1
    @DBrown, At the time this answer was posted Visual Studio Code could not be killed in that manner because the only process exposed was electron. I no longer have the latest version installed, so I cannot test if the same is still true now as when this answer was originally written. – user3439894 Sep 12 '18 at 1:00
  • Ah, fair enough. I tested this particular method with 1.27.1 on OSX 10.13.6, and for a hanging main process this worked very well. Of course in other situations the Electron frontend will persist, but at the very least this will allow users to kill the main sleeping/zombie process and be notified to reopen to a new session. Was this what you experienced with older versions? – DBrown Sep 12 '18 at 17:35
  • @DBrown, I want to say it handle everything but I honestly do not remember, as it was 14 months ago, and I do not have the particular system it was run on handy to look back at, if it was still installed. – user3439894 Sep 13 '18 at 4:00
2
  • 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>
  • thanx, but i am looking for a generic approach without any manually lookup necessary :) – itinance Jul 19 '17 at 8:39
  • You only need to do the lookup once, to get the process name (which will be the same the next time) – nohillside Jul 19 '17 at 8:48
  • @klanomath thx, the german/english auto detection sometimes doesn't work so well on iOS :-) – nohillside Jul 19 '17 at 10:08
0

This one is working for me, pkill Electron or pkill Visual Studio Code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .