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.
@alg

This comment has been minimized.

Copy link

commented Jul 13, 2016

This is too radical. I'd suggest going to the System Preferences / Users & Groups / / Login Items and removing "Android File Transfer Agent" from the list. This way you will still be able to launch it when you need it.

@lilac

This comment has been minimized.

Copy link

commented Jul 29, 2016

@alg the way you suggested does work. The agent is still launched when inserted with the usb.

@bdpiparva

This comment has been minimized.

Copy link

commented Jul 29, 2016

@zeroseis: Thanks.

@shahidghafoor00

This comment has been minimized.

Copy link

commented Aug 19, 2016

just put this command in Terminal (Mac).

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"'

@matejvida

This comment has been minimized.

Copy link

commented Aug 23, 2016

@rb-shahid

Your solution work like a charm!

@octohub

This comment has been minimized.

Copy link

commented Aug 29, 2016

@rb-shahid solution worked for me as well, thank you!

@marqzosvaldo

This comment has been minimized.

Copy link

commented Sep 21, 2016

@rb-shahid Thanks!. works for me

@devchaitu18

This comment has been minimized.

Copy link

commented Oct 12, 2016

Thanks very much, i was getting very irrated while degubbing android app, this file transfer always opens up.

@pdonorio

This comment has been minimized.

Copy link

commented Oct 12, 2016

Works, thaaaaaaank you

@gmale

This comment has been minimized.

Copy link

commented Oct 13, 2016

works, thanks. files renamed, login item removed. 👍

Dear "Android File Transfer Agent":

Don't call us, we'll call you.

Sincerely,
~ Everyone

@suojiang

This comment has been minimized.

Copy link

commented Oct 16, 2016

works, thanks. files renamed, login item removed.

Dear "Android File Transfer Agent":

Don't call us, we'll call you.

Sincerely,
~ Everyone

@rene-dohan

This comment has been minimized.

Copy link

commented Oct 28, 2016

@rb-shahid your the man ! And for Android File Transfer developers just : WTF

@Hackmodford

This comment has been minimized.

Copy link

commented Oct 29, 2016

Thank you so much. This was the most annoying app I've ever had installed >:(

@naeemark

This comment has been minimized.

Copy link

commented Dec 7, 2016

Thanks 👍

@locovna

This comment has been minimized.

Copy link

commented Dec 9, 2016

😚

@pawarvaibhav

This comment has been minimized.

Copy link

commented Jan 7, 2017

Awesome, this worked like a charm. Thanks @zeroseis

@mustafaerturk

This comment has been minimized.

Copy link

commented Feb 1, 2017

thanks 👍

@jaspervergeer

This comment has been minimized.

Copy link

commented Feb 24, 2017

@rb-shahid Thanks

@DanielSmedegaardBuus

This comment has been minimized.

Copy link

commented May 2, 2017

FYI, these approaches only work until you reinstall or update the application.

Another approach is to make the agent unreachable, then change its owner to the root user so that an update/reinstall cannot revert your changes. In a terminal:

chmod 000 ~/Library/Application\ Support/Google/Android\ File\ Transfer/Android\ File\ Transfer\ Agent.app
sudo chown root:wheel ~/Library/Application\ Support/Google/Android\ File\ Transfer/Android\ File\ Transfer\ Agent.app

Obviously, the agent is still already running, so you will have to kill it in Activity Monitor.

To undo it:

sudo chown $UID:staff ~/Library/Application\ Support/Google/Android\ File\ Transfer/Android\ File\ Transfer\ Agent.app
chmod 755 ~/Library/Application\ Support/Google/Android\ File\ Transfer/Android\ File\ Transfer\ Agent.app
@machadaCosta

This comment has been minimized.

Copy link

commented May 3, 2017

@zeroseis Thanks 👍
This was really intrusive and annoying!

@dmonti

This comment has been minimized.

Copy link

commented May 3, 2017

@DanielSmedegaardBuus thanks, much better!

@replete

This comment has been minimized.

Copy link

commented May 14, 2017

Mac OS Sierra.
This is still the only way to achieve this.

@alexandrucaraus

This comment has been minimized.

Copy link

commented May 29, 2017

Thanks,

@Porubay

This comment has been minimized.

Copy link

commented May 29, 2017

Thank for that nice android transfer!

@DWAK-ATTK

This comment has been minimized.

Copy link

commented Jun 19, 2017

This REALLY needs to be an option within the application.

I write Android apps on Windows in a macOS Parallels VM. While the VM properly captures the android device, macOS still generates a "hey, an android device was plugged in" signal. AFT then pops up, but by this time the VM has captured the device and its not available to macOS. So then I get the app alert: No device is connected.

This is TERRIBLY annoying!!

Please, give us the option from within AFT to disable the USB agent.

@Kimeiga

This comment has been minimized.

Copy link

commented Jul 21, 2017

thank you all so much <3

@tejasanilshah

This comment has been minimized.

Copy link

commented Aug 12, 2017

This was very useful. Thanks.

@BMarton

This comment has been minimized.

Copy link

commented Sep 26, 2017

@dburr

This comment has been minimized.

Copy link

commented Oct 23, 2017

Important note: if you are running OS X 10.13 High Sierra, this hack will cause undeletable "Unknown" login items to appear in your Login Items. These bogus/corrupted "unknown" items can cause some apps to crash. For now I've switched to using the command-line adb tool to copy files to/from my device, which is clunky but works. There is some discussion of this bug (and a fix/workaround) on this Github issue.

@michaellass

This comment has been minimized.

Copy link

commented Oct 24, 2017

There is a relatively clean way to circumvent this issue. Very brief:

  1. Create an application that does nothing using Automator
  2. Replace the Agent app under /Applications/... by your created noop app
  3. Stop any running agent and remove its copy under ~/Library

This way, the login item stays valid since it refers to an existing app and isn't duplicated on each launch.

I wrote up the required steps in a bit more detail here: https://0xstubs.org/prevent-autostart-of-android-file-transfer-on-macos/

@ablyeom

This comment has been minimized.

Copy link

commented Oct 28, 2017

amazing!

@naveenuvp

This comment has been minimized.

Copy link

commented Nov 1, 2017

@rb-shahid Great..It worked.. Thanks Shahid

@narzero

This comment has been minimized.

Copy link

commented Nov 5, 2017

@michaellass, works! thank you.

@kevin-renier

This comment has been minimized.

Copy link

commented Nov 15, 2017

@rb-shahid

So easy and works perfectly! Thanks :)

@jessejiang0214

This comment has been minimized.

Copy link

commented Dec 7, 2017

Ok, the problem is the app crashed after did this.

@fi8er1

This comment has been minimized.

Copy link

commented Dec 7, 2017

@rb-shahid

Your solution works haffa, pumma!

@alfanhui

This comment has been minimized.

Copy link

commented Jan 9, 2018

Thank you

@erhanbicer

This comment has been minimized.

Copy link

commented Jan 16, 2018

@rb-shahid

one code, one kill :) thank you

@jduerr

This comment has been minimized.

Copy link

commented Feb 24, 2018

Very nice !!!

But - Did not do the trick for me with copy and paste --> the .app file within the application bundle was not located in /Contents/Resources/*** but in /Contents/Helpers/ (...)

So for me I had to change the Terminal command to:

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"'

@zeyangl

This comment has been minimized.

Copy link

commented Feb 27, 2018

This doesn't seem to work with the latest android transfer, which automatically recreates the .app file in Application Support and adds itself back to login item. It really needs an option in the app itself..

@GHubJames

This comment has been minimized.

Copy link

commented Mar 5, 2018

Further to yesterday, file transfer adds itself to login items. Here's a short script which opens file transfer when run, and stops the process when the file window is shut, stops the agent.
And removesthe login item, and removes the agent in the user's Library:

open /Applications/Internet+phone/Android\ File\ Transfer.app &&
sudo killall 'Android File Transfer Agent' &&
sudo killall 'Android File Transfer'
osascript -e 'tell application "System Events" to delete login item "Android File Transfer Agent"'
rm "~/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent.app/Contents/MacOS/Android File Transfer Agent"

Put this in a script e.g. "fandroid", make it executable, and click it after connecting an android device. It'll ask for a admin password which is probably not necessary if the process ownership is right - I haven;t checked.

@noln

This comment has been minimized.

Copy link

commented Mar 8, 2018

Per @jduerr's comment, it's moved to /Contents/Helpers/ (...) now, but following the same rename instructions as in the OP's Gist works if you seek out the file in its new location.

I'd imagine that @rb-shahid's script will need updating now though as the agent location's changed.

I'd also like to +1 the general "WTF, how is this not a setting in the app itself?!!" comments.

@msameerbm

This comment has been minimized.

Copy link

commented Mar 16, 2018

@rb-shahid Thanks 💯

@lsnch

This comment has been minimized.

Copy link

commented Apr 25, 2018

Apparently each time you launch AFT this /Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent.app gets copied here ~/Library/Application Support/Google/Android File Transfer/. If you remove/rename the former, the latter won't be recreated.
Entire folder ~/Library/Application Support/Google/Android File Transfer/ can be deleted. It will be recreated next time you launch AFT but it will be empty. This worked for me and I don't see any unknown login items.

@seyedmmousavi

This comment has been minimized.

Copy link

commented May 26, 2018

Thanks 😃 👍

@ifprado

This comment has been minimized.

Copy link

commented May 30, 2018

@rb-shahid 10/10

@Itay80600

This comment has been minimized.

Copy link

commented Jun 6, 2018

@anticitizen4 The easiest and only solution that worked for me

@PaulMuriithi

This comment has been minimized.

Copy link

commented Jun 29, 2018

@jduerr that worked for me, thanks.

@CenotaphSouvenir

This comment has been minimized.

Copy link

commented Jul 4, 2018

@rb-shahid Thanks 👍

@mkows

This comment has been minimized.

Copy link

commented Jul 9, 2018

Thanks @anticitizen4 🥇

@shishirshetty0710

This comment has been minimized.

Copy link

commented Jul 12, 2018

@rb-shahid . God like

@geneparcellano

This comment has been minimized.

Copy link

commented Jul 17, 2018

@alg Thanks. I like your solution, it worked for me.

@anfuca

This comment has been minimized.

Copy link

commented Aug 8, 2018

Thanks! @anticitizen4

@praveendath92

This comment has been minimized.

Copy link

commented Aug 8, 2018

@rb-shahid thank you 🥇

@adrhem

This comment has been minimized.

Copy link

commented Aug 16, 2018

Thank you so much! <3

@chumdoggin

This comment has been minimized.

Copy link

commented Aug 21, 2018

Yup, the app wrecks havoc too when working on USB related setting up on mac os in hack type things. For sure make apps prefs
more broad. Thanks for jotting these down.

@lxc357

This comment has been minimized.

Copy link

commented Sep 10, 2018

@rb-shahid
Works. Thank you sir!

@katappapande

This comment has been minimized.

Copy link

commented Oct 27, 2018

I got some useful information about android file transfer windows at windowsclassroom.com/android-file-transfer-windows
It made my doubt clear.

@swinggraphics

This comment has been minimized.

Copy link

commented Nov 9, 2018

The current version (1.0.11 as of November 2018) is quite different:

  1. Do quit AFT and the agent, and remove the agent from startup items.

  2. You have to rename the AFT Agent inside the app's Contents/Helpers.

  3. You have to rename or delete the AFT Agent inside ~/Application Helpers/Google/Android File Transfer.

I guess one copy of the agent wasn't enough, and Google wanted it to stick around even if you delete the transfer app? Jerks.

@hesamaseh

This comment has been minimized.

Copy link

commented Dec 26, 2018

If you dont want to fully uninstall it you can kill the agent from the Activity monitor before you connect your device.

  1. Just open the activity monitor and search for the agent
  2. force kill the agent
  3. connect your gopro
@sergiomeza

This comment has been minimized.

Copy link

commented Dec 29, 2018

@rb-shahid THANKS!

@pratyushtewari

This comment has been minimized.

Copy link

commented Jan 22, 2019

@swinggraphics Thanks.

Thanks! Although for point 3

  1. You have to rename or delete the AFT Agent inside ~/Application Helpers/Google/Android File Transfer.

for me the location was
~/Library/Application\ Support/Google/Android\ File\ Transfer/Android\ File\ Transfer\ Agent.app

@stealthybox

This comment has been minimized.

Copy link

commented Jan 29, 2019

Creating an Automator app called Noop.app and running this script addresses the problem for me.

cat disable-android-file-transfer-agent.sh
#!/bin/bash
# disables auto-start of AFT when plugging in an Android device into USB
# -- prerequisite create an Automator application that launches an empty shell script and save it as /Applications/Noop.app

sudo killall 'Android File Transfer'
sudo killall 'Android File Transfer Agent'

# remove the runtime Library copy
sudo rm -rf "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent.app"
# remove the source app
sudo rm -rf "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent.app"
# copy the Noop app into the source location
sudo cp -r "/Applications/Noop.app" "/Applications/Android File Transfer.app/Contents/Helpers/"

inspired by: https://gist.github.com/zeroseis/ce66d4c6b776577442a6#gistcomment-2238139

@allurewebsolutions

This comment has been minimized.

Copy link

commented Feb 26, 2019

This is for the newest version of the program:

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"'

@krischik

This comment has been minimized.

Copy link

commented Apr 8, 2019

Over time a switched to Script that looks at all the places. This has the advantage of being easier to read them 5 commands on one terminal line and it can be quickly started after each update. And last not least one can easily add more location to search in case Google moves stuff again:

#!/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"'
@rraallvv

This comment has been minimized.

Copy link

commented May 9, 2019

Android File Transfer is the most annoying piece of software I've forced to use, seriously, why someone would thing it needs to run on every launch whether the user wants it or not.

@arminio

This comment has been minimized.

Copy link

commented Jun 2, 2019

This is too radical. I'd suggest going to the System Preferences / Users & Groups / / Login Items and removing "Android File Transfer Agent" from the list. This way you will still be able to launch it when you need it.

@alg This does work. thank you! (I just needed to kill/stop the agent process manually after removing it from the list as you suggested)

@lkjh654

This comment has been minimized.

Copy link

commented Jul 2, 2019

@krischik

that's awesome, thx

@mihajloS

This comment has been minimized.

Copy link

commented Jul 4, 2019

@alg Thank you. Worked for me.

@moreaki

This comment has been minimized.

Copy link

commented Jul 6, 2019

@krischik: thank you!

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.