Double-click bash file -> pwd outputs my home directory instead of the current directory In my Downloads directory, I have an executable bash script :

#!/bin/bash
pwd


when I double-click on it, pwd outputs my home directory. But I want my script to run from the current directory from where it was clicked.
Scripts/commands are always run from your home directory (which may be inconvenient for scripts run both from Terminal and from Finder). To find the directory they are stored in you need to look at $0 (which contains the full path and name of the script):

#!/bin/bash
echo '$0:' $0
echo 'Script stored at:' ${0%/*}
cd "${0%/*}"
pwd