You need to add a path variable in bash profile
I have written this answer based on the discussion with Commansware and Pierre on Commansware answer.
Let's discuss these questions to fix the command not found the issue on Android Studio.
Where is apksigner?
You can find apksigner at Android/sdk/build-tools/30.0.3
How to use apksigner using terminal?
with absolute path (painful way)
$ ~/Library/Android/sdk/build-tools/30.0.3/apksigner verify ~/Desktop/app-release.apk
with $path variable (the smart way)
$ apksigner verify ~/Desktop/app-release.apk
For this, you need to set a path variable in your bash profile
How to set path variable?
Add this to your bash profile
export PATH="$PATH:$HOME/Library/Android/sdk/build-tools/30.0.3"
Now you should be able to run $ apksigner verify ~/Desktop/app-release.apk
anywhere even inside Android Studio terminal.
Still can't run the command on Android Studio?
In my case, I was not able to run apksigner
command even after setting the path variable. So wrote export PATH="$PATH:$HOME/Library/Android/sdk/build-tools/30.0.3"
on Android Studio terminal. And it worked!
Extra discussion
apksigner is part of Android Studio CLI tools. But I found that other Android Studio CLI tools (d8, avdmanager, aapt etc) command work by default except for apksigner. I don't know if it was just me or if it happens with others too.