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 likeAndroid 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 likeAndroid 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"'
Thanks! Just what I needed. I usually watch TV shows in the evening on my MBP and plug in my phone to charge it. Android File Transfer annoyingly opens TWICE every time I plug in my phone, switching my screen from what I’m trying to watch. I copy-pasted this script into the Terminal and voila! no more AFT automatically starting when I just want to charge my phone!
Aah! Why didn’t you lead with the one-liner?!
Well, I did say it wasn’t very pretty 😉
dude next time start with the one liner… sigh
Exactly, put it in a TLDR section at the top of the article! 🙂
I followed the long instructions which worked fine though, thanks!
Such ease — many thanks dude!
Thanks a lot for that great guide! The one-liner made it straight to my setup script 🙂
Thanks for this. Excellent.
Worked like a charm. Thanks for posting! And yes, you need to put the not-so-pretty one liner at the top of the list.
Wau! 100 thanks.
Such a relief! Thank you! That was driving me a bit batty…
I was repeatedly uninstalling the app because it auto-starting all the time drove me crazy. Very happy you found a way to disable it.
Awesome!
Brilliant! Thanks 🙂
Thanks! It’s way easier to just use the Terminal command rather than go through all the steps. Even for non-geeks! Again, thanks.
Thanks a lot, I was really tired of this autostart.
Worked like a charm. Thanks!
A big relief. Thank a lot.
Can you please send instructions for undoing the command line you provide above? It works perfectly in that it prevents Android File Transfer from starting automatically, but now when I stop the Faveset Klink software I get an “adb quit unexpectedly” error. I uninstalled Android File Transfer and that did not fix the problem. Thanks for your help.
Since posting my comment, I found a “Persist ADB On Exit” setting on Faveset Klink that seems to solve the problem.
Glad you found a solution. I’ll edit my post in the next day or so to include instructions for reverting back to default behavior.
Can you please add the script for undoing it? 🙂
I really do keep meaning to do that, so thank you for reminding me. It’s late here now but I’ve made a note and will add it this weekend. 🙂
Dude so awesome. Thankfully I scrolled down and found the one-line, copied it into my terminal and tada! You rock!
Don’t kid yourself! That one-liner is a thing of beauty!
That not-so-pretty One-Liner code is the most sweet code ever for me, now! Thanx dude!
Very nice. And great that kept the solution current (as of 2013-01-08).
Terminal command worked like a charm
Many thanks!
Solution still worked (I’m running El Capitan)
Legend!!! Thanks a lot – this was driving me mad!
Oh btw maybe add a link to the one liner at the top of the page (I bet a lot of the traffic to this page are android devs that would appreciate your awesome little snippet).
Thank you, and good point. I’ve now added a TL;DR link to the top of the post. Cheers!
Hi,
thanks for that.
Worked for me.
But why do you mention the simples solution with the code at the end?
Oh, just saw you already did it. Thanks for it.
No problem. 🙂
I keep meaning to update this post properly and move the command line method to the top. I’ll try and do that this weekend.
He/she said in 2016. Procrastinating much? 😉 But many thanks. I don’t feel harassed by android anymore.
Oh I’m sorry, you already put it at the top. I didn’t see it because I always skip the intro and go right to the steps.
Thank you!
Wouldn’t it be easier to just
`launchctl remove com.google.android.mtpagent`
well you would have to do that again each time there is a software update but that’s alright I guess.
Best regards
October 2017, OS X 10.12.5 and this is still working great!
An even simpler solution: open “Android File Transfer.app” and stop the process “Android File Transfer Agent”.
A practical way to do this: Edit a file named, say “fandroid”
Contents of this file:
“open /Applications/Android\ File\ Transfer.app
sudo killall ‘Android File Transfer Agent”
Amend this if the executable is elsewhere, obviously. Make this fandroid file executable (“chmod +x fandroid”), make sure it’s location is in your search path, and thereafter start it from the terminal: fandroid.
Or put a link in a handy executables folder, say on the dock, and bob’s your uncle: Click and go – android folders open in Finder when it’s clicked.
And only if it’s clicked.
Bloomin’ developers. What a pain in the neck.
Thanks! On High Sierra, I had to modify the directory from Resources to Helpers.
Confirmed for Catalina
Thanks for reminding me I needed to update the instructions. Done now. Cheers!
Thank you very much, Monkey Hybrid! All done just fine
This is so amazingly helpful. Android file transfer is so annoying I use my phone for tethering internet to my computer for 4+ hours a day and this thing would pop up twice every time i jiggled the cord. This is so tremendously helpful to me saving me countless annoying moments.
Still working after all these years. Thanks for saving the reading time with the one-liner – sweet! Wish all my tech headaches were solved so quickly 🙂
Thanks for the TDLR
Thank you MonkeyBird.
Actually, I did all your steps except the one that renaming the application! Because I did not find the application under the ~/contents/resources’s directory. So, I escaped this step. Now everything is fine.
Regards,
Ali
Thanks so much, this still works today with a small change, the Android File Transfer Agent.app is under `Contents/Helpers` at least in my machine which is running High Sierra.
Glad it helped! Thanks for the heads-up regarding High Sierra, I’ve been meaning to update this post for a long time. I’ll get on to that in the next couple of weeks.
Thanks for the help! Works like a charm. This thing fucked my up so much xD
thank you soO much
It was annoying , but with your instructions, Boommmmm !!