mac os x – My phone is charging my MacBook over USB C, and not showing up as an adb device. Is there a fix?

Sorry in advance if this is a duplicate, I couldn’t find a solution to this exact problem posted anywhere.

I’m using Unity on macOS and I am trying to build for Android. I’m running into an issue where my development phone (it’s a Galaxy A5 2017) will start charging my MacBook when I plug it in and will not show up as an adb device.

What I’ve done so far is:

  • Enable USB debugging on my phone
  • Install android-sdk and android-platform-tools through homebrew
  • Install openjdk@8 through homebrew (this resolved an issue where the sdk required java 8)
  • Attempt to switch the USB mode on the phone from ‘Charge connected device’ to ‘Transfer files’
  • Switch USB ports

Trying to switch USB modes on the phone does not seem to work, it will close the dialog when selecting ‘Transfer files’ but when I check in the notification shade it will still be set to ‘Charge connected device’. I also tried checking if the phone showed up over adb, but unfortunately adb devices returns an empty list.

Potentially useful information: I have built this exact Unity project to this exact phone successfully from my Windows desktop with this USB C to C cable, but I need to be able to do this from my MacBook.

I am using:

  • Unity 2021.1.4f
  • macOS Big Sur 11.4
  • Android 8.0.0

My question is, how can I prevent my phone from trying to charge the Mac? How can I get it to show up as an adb device so I can build to it from Unity?