Thursday 7 June 2012

Trying to find out what Mac OSX process is using a particular app

I was trying to remove / trash an app from my Mac ( Xcode.app for the record ), but Finder wasn't allowing me to empty the trash, telling me that something was using the app. even though I knew that it was not running.

To find out what, I put the app back into /Applications ( using the "Put Back" option in Finder / Trash, and then opened up a command prompt.

First I looked to see what was left in the Xcode app folder: -

$ find /Applications/Xcode.app/

/Applications/Xcode.app/
/Applications/Xcode.app//Contents
/Applications/Xcode.app//Contents/Resources
/Applications/Xcode.app//Contents/Resources/java-source_Icon.icns

Then I checked to see what was locking that one remaining file - java-source_lcon.icns: _

$ lsof /Applications/Xcode.app/Contents/Resources/java-source_Icon.icns 

COMMAND   PID      USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
SystemUIS 181 david_hay  txt    REG   14,2    44028 10107074 /Applications/Xcode.app/Contents/Resources/java-source_Icon.icns


Then I killed the process: -

$ kill -9 181

( which caused the OSX menu bar to restart )

Then I checked to see whether the lock had been released: -

lsof /Applications/Xcode.app/Contents/Resources/java-source_Icon.icns 

which reported nowt, nothing, nil, nada.

Then I trashed the app again.

Then I emptied the trash :-)

Job done !

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...