Disable auto launching of Photos application on Mac OSX Yosemite & El Capitan

command lineosx-el-capitanosx-yosemitephotosremovable-media

I'm aware that there are solutions existing that allow you to prevent auto launch of applications such as iphoto or the newer replacement, Photos on a per device basis through the UI of Photos itself, and more comprehensive control (can set what application opens) through Image Viewer, but my question is if there is a way to stop Photos from auto-launching universally (no matter what removable media I mount), preferably by issuing a default write command or disabling a launchd plist or similar.

I tried figuring this out on my own, using an article from lifehacker "How to Find Hidden Features in Mac Applications".

I've issued the following commands:

strings /Applications/Photos.app/Contents/MacOS/Photos > Desktop/photosstrings.txt

class-dump /Applications/Photos.app/Contents/MacOS/Photos > Desktop/photosclassdump.txt

strings /Applications/Photos.app/Contents/MacOS/PhotosRelauncher > Desktop/photosrelauncherstrings.txt

class-dump /Applications/Photos.app/Contents/MacOS/PhotosRelauncher > Desktop/photosrelauncherclassdump.txt

Output of above can be viewed/downloaded via Gist

I've tried out a few stabs with promising strings such as:

defaults write com.apple.Photos canAutoLaunch = 0

defaults write com.apple.Photos shouldAutoLaunch = 0

No luck so far. I did a:

defaults read com.apple.Photos

which shows the two writes did get written, but they're not doing anything obvious, and definitely not what I was going for.

I'm not sure what service to do killall on for quicker testing, rebooting to test is kinda overkill. Activity Monitor shows the following with "photo" as the search term:

Photos Agent
com.apple.CloudPhotosConfiguration
Photolibraryd
com.apple.photomoments
com.apple.photomodel
Photos

I've tried doing a defaults read on Photos Agent and so on even escaping characters and other variations and whatever with no luck either.

Would appreciate help in achieving the desired effect. Would love education along the way too if that's not too much to ask.

Best Answer

This worked for me in Yosemite.

# -currentHost is not technically required
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool YES

It came from answer to a similar question on AskDifferent:

https://apple.stackexchange.com/questions/188212/prevent-photos-app-on-osx-yosemite-from-starting-when-plugging-in-device

Interestingly the UI setting in Image Capture doesn't do anything but this does.

Related Question