Bitcoin-Qt command line control on Mac

I’m trying to communicate with the new Bitcoin-Qt -server via a command line on Mac. I run ./Bitcoin-Qt -server, the application starts, but my terminal window is stuck on an empty line (no matter what I type in, there is no response). Only when I quit Bitcoin am I able to run any commands, but then I can’t communicate with Bitcoin, because it is already off.

How do I start Bitcoin-Qt -server on Mac and control it through command line?

Answer

You can start it from the command-line using:

open Bitcoin-Qt.app --args -server

I think the --args option to open is OSX 10.6 and later; if you are running an older OSX put server=1 in your ~/Library/Application Support/Bitcoin/bitcoin.conf file. In fact, to use the -server command you must set a -rpcuser/-rpcpassword, so I’d suggest creating a bitcoin.conf that contains:

server=1
rpcuser=yourname
rpcpassword=...something else

We don’t ship a bitcoind for the Mac, but you can use curl (for example) to send commands to the running Bitcoin-Qt:

curl --user yourname --data-binary '{"id":"t0", "method": "getinfo", "params": [] }' http://127.0.0.1:8332/

The bitcoin source tree also contains python code that uses the free ‘jsonrpc’ library to communicate with a running Bitcoin-Qt (see contrib/bitrpc/).

Leave a Reply

Your email address will not be published. Required fields are marked *