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.

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

lilac 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.

bdpiparva commented Jul 29, 2016

@zeroseis: Thanks.

@rb-shahid

This comment has been minimized.

rb-shahid 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.

matejvida commented Aug 23, 2016

@rb-shahid

Your solution work like a charm!

@octohub

This comment has been minimized.

octohub commented Aug 29, 2016

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

@marqzosvaldo

This comment has been minimized.

marqzosvaldo commented Sep 21, 2016

@rb-shahid Thanks!. works for me

@devchaitu18

This comment has been minimized.

devchaitu18 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.

pdonorio commented Oct 12, 2016

Works, thaaaaaaank you

@gmale

This comment has been minimized.

gmale 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.

suojiang 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.

rene-dohan commented Oct 28, 2016

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

@Hackmodford

This comment has been minimized.

Hackmodford 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.

naeemark commented Dec 7, 2016

Thanks 👍

@locovna

This comment has been minimized.

locovna commented Dec 9, 2016

😚

@pawarvaibhav

This comment has been minimized.

pawarvaibhav commented Jan 7, 2017

Awesome, this worked like a charm. Thanks @zeroseis

@mustafaerturk

This comment has been minimized.

mustafaerturk commented Feb 1, 2017

thanks 👍

@jaspervergeer

This comment has been minimized.

jaspervergeer commented Feb 24, 2017

@rb-shahid Thanks

@DanielSmedegaardBuus

This comment has been minimized.

DanielSmedegaardBuus 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.

machadaCosta commented May 3, 2017

@zeroseis Thanks 👍
This was really intrusive and annoying!

@dmonti

This comment has been minimized.

dmonti commented May 3, 2017

@DanielSmedegaardBuus thanks, much better!

@replete

This comment has been minimized.

replete commented May 14, 2017

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

@alexandrucaraus

This comment has been minimized.

alexandrucaraus commented May 29, 2017

Thanks,

@Porubay

This comment has been minimized.

Porubay commented May 29, 2017

Thank for that nice android transfer!

@DWAK-ATTK

This comment has been minimized.

DWAK-ATTK 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.

Kimeiga commented Jul 21, 2017

thank you all so much <3

@tejasanilshah

This comment has been minimized.

tejasanilshah commented Aug 12, 2017

This was very useful. Thanks.

@BMarton

This comment has been minimized.

BMarton commented Sep 26, 2017

@dburr

This comment has been minimized.

dburr 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.

michaellass 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.

ablyeom commented Oct 28, 2017

amazing!

@naveenuvp

This comment has been minimized.

naveenuvp commented Nov 1, 2017

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

@narzero

This comment has been minimized.

narzero commented Nov 5, 2017

@michaellass, works! thank you.

@kevin-renier

This comment has been minimized.

kevin-renier commented Nov 15, 2017

@rb-shahid

So easy and works perfectly! Thanks :)

@jessejiang0214

This comment has been minimized.

jessejiang0214 commented Dec 7, 2017

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

@fi8er1

This comment has been minimized.

fi8er1 commented Dec 7, 2017

@rb-shahid

Your solution works haffa, pumma!

@alfanhui

This comment has been minimized.

alfanhui commented Jan 9, 2018

Thank you

@erhanbicer

This comment has been minimized.

erhanbicer commented Jan 16, 2018

@rb-shahid

one code, one kill :) thank you

@jduerr

This comment has been minimized.

jduerr 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.

zeyangl 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.

GHubJames 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.

noln 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.

@sameercodes

This comment has been minimized.

sameercodes commented Mar 16, 2018

@rb-shahid Thanks 💯

@lsnch

This comment has been minimized.

lsnch 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.

seyedmmousavi commented May 26, 2018

Thanks 😃 👍

@ifprado

This comment has been minimized.

ifprado commented May 30, 2018

@rb-shahid 10/10

@Itay80600

This comment has been minimized.

Itay80600 commented Jun 6, 2018

@anticitizen4 The easiest and only solution that worked for me

@PaulMuriithi

This comment has been minimized.

PaulMuriithi commented Jun 29, 2018

@jduerr that worked for me, thanks.

@CenotaphSouvenir

This comment has been minimized.

CenotaphSouvenir commented Jul 4, 2018

@rb-shahid Thanks 👍

@mkows

This comment has been minimized.

mkows commented Jul 9, 2018

Thanks @anticitizen4 🥇

@shishirshetty0710

This comment has been minimized.

shishirshetty0710 commented Jul 12, 2018

@rb-shahid . God like

@geneparcellano

This comment has been minimized.

geneparcellano commented Jul 17, 2018

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

@anfuca

This comment has been minimized.

anfuca commented Aug 8, 2018

Thanks! @anticitizen4

@praveendath92

This comment has been minimized.

praveendath92 commented Aug 8, 2018

@rb-shahid thank you 🥇

@adrhem

This comment has been minimized.

adrhem commented Aug 16, 2018

Thank you so much! <3

@chumdoggin

This comment has been minimized.

chumdoggin 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.

lxc357 commented Sep 10, 2018

@rb-shahid
Works. Thank you sir!

@katappapande

This comment has been minimized.

katappapande 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.

swinggraphics 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment