OS X doesn't store your password, so you cannot read it from some file or database.
What you can do is perform a log-in of some kind, e.g. using su myusername
. If you don't want to open a shell, you can always close the opened shell immediately by su myusername -c exit
.
Alternatively, if you're a sudoer, use sudo -v
to just update your timestamp. It will ask for your password, but not run anything else. This will not work if you recently entered your password for sudo
though. You can invalidate your sudo timestamp using sudo -k
though, so just run that before sudo -v
(and maybe just afterwards, to be safe).