Stop Android File Transfer application auto-starting on OS X

These instructions have been slightly tweaked and re-tested on more recent versions of macOS than when it was first written. I can confirm it works on everything from High Sierra to Catalina, and I’ve no reason to think it wouldn’t work as expected on Big Sur too.

TL;DR: If you’re not interested in following the steps one by one, jump straight to the command line solution.

If you’ve installed the Android File Transfer application for OS X, you’ll find it automatically starts each time you connect your Android device to your Mac. This behaviour is fine if you only connect your Android device to your Mac for the purpose of transferring files, but it becomes a bit of a nuisance when you just want to charge your device or use it for development purposes.

There’s no setting within the app to disable auto-starting so you need to manually disable the agent that ‘listens’ for Android device connections. Here’s how to do that.

  • Open Activity Monitor and quit the ‘Android File Transfer Agent’ process.
  • Open the Applications directory within Finder.
  • Ctrl-click (or right-click) Android File Transfer.app and select ‘Show Package Contents’.
  • Drill down into the Contents/Helpers directory.
  • Rename Android File Transfer Agent.app to something like Android File Transfer Agent DISABLED.app.
  • Navigate to the ~/Library/Application Support/Google/Android File Transfer directory in Finder (you may need to hold down ‘alt’ within Finder’s ‘Go’ menu to see ‘Library’).
  • Again, rename Android File Transfer Agent.app to something like Android File Transfer Agent DISABLED.app.
  • Open the Users & Groups panel in System Preferences, and remove any entry for ‘Android File Transfer Agent’ in your user’s ‘Login Items’.

Done! You can still manually start the Android File Transfer application (as you would for any other application) but now there’s no more auto-starting.

If you want to re-enable auto-starting at a later date, simply rename the two app files back to their original names and manually start the Android File Transfer application to kick start the agent again.

From the command line

PID=$(ps -fe | grep "[A]ndroid File Transfer Agent" | awk '{print $2}')
if [[ -n $PID ]];
then
    kill $PID
fi
mv "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent.app" "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent DISABLED.app"
mv "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent.app" "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent DISABLED.app"
osascript -e 'tell application "System Events" to delete every login item whose name is "Android File Transfer Agent"'

Here’s a not-so-pretty one line version you can copy and paste:-

PID=$(ps -fe | grep "[A]ndroid File Transfer Agent" | awk '{print $2}'); if [[ -n $PID ]]; then kill $PID; fi; mv "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent.app" "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent DISABLED.app"; mv "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent.app" "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent DISABLED.app"; osascript -e 'tell application "System Events" to delete every login item whose name is "Android File Transfer Agent"'