Monday, February 26, 2024

Disable Android File Transfer from starting automatically

If you’re an Android device owner with a Mac, chances are you’ve installed the rather rudimentary app called Android File Transfer. This app gets one useful job done, namely to transfer files between Mac and Android. Yet, for many of us it’s a nuisance that Android File Transfer launches every time you plug your Android device into the computer. In my case, I rarely need to use AFT. I mostly plug my phone in for tethering purposes. 

So, here’s how to disable AFT from launching automatically. I found numerous solutions to this issue, but most had become redundant as AFT was updated, or are too complicated for many people. Credit for this solution goes to krischik on Github.

In Terminal launch change to the directory where you want the script, and then create a new file with nano:

cd /path/to/where/you/want/the/script

Then paste in the following code:


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

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

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

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

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

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

You’ll then need to make the file executable, and run it:

chmod u+x

Recent Articles


Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox