How to setup testnet-in-a-box on Mac OSX? I'm trying to setup testnet-in-a-box and I'm a little unclear on how you get the command line version working for mac as described here:

http://sourceforge.net/projects/bitcoin/files/Bitcoin/testnet-in-a-box/

I installed macports and ran sudo port install bitcoin so I have a bitcoind executable now.

Instead of

bitcoin -datadir=1 -daemon
bitcoin -datadir=2 -daemon


Do I just use?

bitcoind -datadir=1
bitcoind -datadir=2


Also, since there are two nodes do they have to run on different ports?  Thanks
Yes, run bitcoind instead of bitcoin.

If bitcoind isn't working, but bitcoin-qt is working, then do this instead:

bitcoin-qt -server -datadir=1
bitcoin-qt -server -datadir=2


This will only work if you run the commands from inside the testnet-box folder.  Alternatively specify full path names to the 1 and 2 folders: datadir=/home/chris/testnet-box/1 etc.

You need to download the testnet-box.zip file and extract it.  That will make you the two folders 1 and 2.  Both folders have testnet blockchain files, a wallet, and a bitcoin.conf.

Folder 1's bitcoin.conf says:

rpcpassword=123   # Set this yourself.
noirc=1
testnet=1


so it will run a testnet instance, not connect to IRC, and set the password to '123' for RPC connections.

Folder 2's bitcoin.conf says:

rpcpassword=123   # Set this yourself.
noirc=1
testnet=1
rpcport=19332
nolisten=1
connect=127.0.0.1:18333


which is the same as the other except that it listens for RPC connections on a different port, doesn't listen for incoming P2P connections at all, and only connects to the other instance.

There shouldn't be a port conflict.  The first will be listening on port 8332 for RPC connections and port 18333 for P2P connections.  The second will be listening on port 19332 for RPC connections, and not listening for P2P connections at all.

Note: if you're running the 0.6.0 release candidate, the nolisten=1 in node 2's bitcoin.conf won't work.  You'll need to change it to listen=0 due to a bug I found and reported while researching this answer.