Skip to content

Instantly share code, notes, and snippets.

@sezabass
Created June 16, 2021 21:39
Show Gist options
  • Save sezabass/9d8875847d01b8cd7c79ed4ff858ae54 to your computer and use it in GitHub Desktop.
Save sezabass/9d8875847d01b8cd7c79ed4ff858ae54 to your computer and use it in GitHub Desktop.
Enable/disable Android File Transfer agent on MacOS
# alias for disabling Android File Transfer agent
disableFileTransfer(){
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"'
}
# alias for enabling Android File Transfer agent
enableFileTransfer(){
mv "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent DISABLED.app" "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent.app";
mv "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent DISABLED.app" "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent.app"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment