Good news and bad news.
Good news first. It WORKED! Hurray! Thanks so much for your help.
Bad news. Even though it worked, I got odd results.
First to keep my password out of the terminal history I tried:
read x; curl --user testUser --data-binary '{"method": "walletpassphrase", "params": ["$x", "120"] }' http://127.0.0.1:8332/; unset x
and got
{"result":null,"error":{"code":-14,"message":"Error: The wallet passphrase entered was incorrect."},"id":null}
Even though I could see my passphrase where I typed it, and it was correct.
So then I tried:
curl --user testUser --data-binary '{"method": "walletpassphrase", "params": ["
", "120"] }' http://127.0.0.1:8332/
Using my actual passphrase in place of
, and I got
{"result":null,"error":{"code":-1,"message":"value is type str, expected int"},"id":null}
The only string I saw in the command where an INT might be expected was the "120", so I tried:
curl --user testUser --data-binary '{"method": "walletpassphrase", "params": ["
", 120] }' http://127.0.0.1:8332/
And this time, oddly enough, I got
{"result":null,"error":{"code":-17,"message":"Error: Wallet is already unlocked."},"id":null}
So my best guess is that when I got the
{"code":-1,"message":"value is type str, expected int"}
error, it must have unlocked the wallet anyhow and just not set any timeout, because the "dumpprivkey" then worked.
Thanks again for all your help! Hopefully this thread will be useful for many other OSX users.