Category Archives: BitCoin

BitCoin Mining Through an SSH Tunnel on Mac OS X with BFGMiner &

  1. Signup for a mining pool.  If this article helped you, please signup for a mining account at to join my pool.  You can signup by yourself on or for another pool, but I’d appreciate you joining my pool or donating BitCoin to “1H3scrfsKd7xJYCA38KxieBTRVRsVw3P9q” if the article helped you out.
  2. Download a BitCoin client and create your wallet:  I encrypted my wallet via the menu option “Settings->Encrypt Wallet” so that no-one can make changes to my wallet or initiate payments without my password.  I’m using because it seemed to be the most official one when I started mining.  If this is the first time you’re launching it it will take a while for it to sync up all the transactions from the network.
  3. In your BitCoin client under “Receive Coins” make note of the “Address” and set it in your mining pool account (i.e. so that the pool knows where to send your coins.  On you do this under the “Account” page in the “Change payout address” section.
  4. Install a tunnel plist into ~/Library/LaunchAgents/com.ssh.tunnels.plist to tunnel an open outgoing port to the mining site you wish to use.  Here we tunnel to which uses port 3334 See the example Launch-Agent plist below as a guide. The command to load the plist on the command line in Terminal is
    launchctl load -w -S Aqua ~/Library/LaunchAgents/com.ssh.tunnels.plist

    This configuration assumes you have SSH keys setup on the server for the tunnel to connect without entering a passphrase.  ”” should be replaced with the name of your server. We’re essentially running:

    ssh -f -N -L

    since we know the port 8081 is passed through the firewall. If you know a different port is available, then change 8081 to the port you know is open. Setting up a server and the SSH keys in order to tunnel your port is outside of the scope of this post.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
    <plist version="1.0">
  5. Build the miner.  I’m assuming you know what MacPorts is and that you have it installed. I’m going to list straight commands here to build on Mac OS X as I’m also assuming the reader has enough prior knowledge with the command line (Terminal) to follow along:
    mkdir -p ~/Miner/Applications
    cd ~/Miner/Applications
    git clone
    cd bfgminer
    git checkout bfgminer-3.0.2
    sudo port install jansson
    sudo port install curl
    ./configure PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/jansson.pc:/opt/local/lib/pkgconfig/libcurl.pc
    make all
  6. Now that you’ve built the miner and you have the “bfgminer” binary it’s time to run it and mine some BitCoins.  Create a worker in your  mining pool for this miner to connect to (i.e. ““).  Run the miner against the worker config you created:
    cd ~/Miner/Applications/bfgminer
    export DYLD_LIBRARY_PATH=./libblkmaker/.libs/
    ./bfgminer -o -u [username] -p [password]

    [username] and [password] refer to the username and password of the miner on your mining pool workers page (i.e. ““). Note that the worker username is prepended with your username. These credentials need to be correct for the miner to connect to the pool properly. If you changed the port number for the Launch Agent SSH tunnel make sure you change 8081 here to the port you used.  Read the bfgminer README to see some additional command line options to tweak the miner.

  7. Join My Pool:
    Donate BitCoin: 1H3scrfsKd7xJYCA38KxieBTRVRsVw3P9q

    UPDATED: The LaunchAgent XML was corrected to match the SSH tunnel description text.