Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable auto start for Android File Transfer
  • Close Android File Transfer
  • Open Activity Monitor and kill “Android File Transfer Agent”
  • Go to where you installed “Android File Transfer.app” (I have it under /Applications)
  • Ctrl+click –> “Show package contents”
  • Go to Contents/Resources
  • Rename “Android File Transfer Agent” to e.g. “Android File Transfer Agent_DISABLED”
  • Then go to “/Users/username/Library/Application Support/Google/Android File Transfer” and again rename the Agent app.
@Swisyn

This comment has been minimized.

Copy link
Owner Author

Swisyn commented Oct 11, 2019

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/Resources/Android File Transfer Agent.app" "/Applications/Android File Transfer.app/Contents/Resources/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"'

@Swisyn

This comment has been minimized.

Copy link
Owner Author

Swisyn commented Oct 11, 2019

#!/bin/zsh

typeset PID=$(ps -fe | grep "[A]ndroid File Transfer Agent" | awk '{print $2}')

if [[ -n ${PID} ]]; then
kill ${PID}
fi

for AFT in
"/Applications/Android File Transfer.app"
"/Applications/Sync/Android File Transfer.app"
"${HOME}/Library/Application Support/Google/Android File Transfer"
do
echo "### Look for agents in “${AFT}”"

if test -e "${AFT}"; then
for AFTA in							\
    "${AFT}/Contents/Resources/Android File Transfer Agent.app" \
    "${AFT}/Contents/Helpers/Android File Transfer Agent.app" 
do
    echo "# Look for agent “${AFTA}”"

    if test -e "${AFTA}"; then
	mv -v "${AFTA}" "${AFTA}.DISABLE"
    fi
done; unset AFTA
fi

done; unset AFT

osascript -e 'tell application "System Events" to delete every login item whose name is "Android File Transfer Agent"'

@Swisyn

This comment has been minimized.

Copy link
Owner Author

Swisyn commented Oct 11, 2019

The permissions trick worked great for me. All I did was:

In Settings app > Users & Groups > Login Items, first unlock the settings panel then remove the Android File Transfer Agent entry
Open a Terminal and sudo -s
Change permissions on the agent app: chmod 000 /Applications/Android\ File\ Transfer.app/Contents/Helpers/Android\ File\ Transfer\ Agent.app
Change ownership to root on the agent app: chown root:wheel /Applications/Android\ File\ Transfer.app/Contents/Helpers/Android\ File\ Transfer\ Agent.app
Delete the Application Support directory: rm -r ~/Library/Application\ Support\Google\Android\ File\ Transfer
Open Activity Monitor and force kill the Android File Transfer Agent process

That's it. I confirmed that re-opening the Android File Transfer app no longer adds the launch entry or makes the copy to Application Support directory and the app no longer auto-launches when a device is plugged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.