Public Key / Private Key Generation in a bash script (osx / ubuntu)
https://en.bitcoin.it/wiki/Vanitygen is a software which will generate BTC address keypairs at the command-line. Its main purpose is actually to generate "vanity" addresses which contain pretty custom strings, but if you run it as follows then you will get a continuous output of many random public-private pairs: ./vanitygen -k 1 (remove the -k to generate only a single pair rather than continuously generate). I have used these addresses in my testing (sending small amounts), and have always found the private-key to be successfully importable and usable in a wallet. I have personally run vanitygen on ubuntu precise and mac os x mt lion.