How to run a bitcoin generator on FreeBSD


After all this bitcoin hype lately and the fact that most clients are made for Linux, no wonder that i have seen several requests on how to run a bitcoin generator under FreeBSD. I’m still not convinced that bitcoins are more than a pyramid scheme, but i decided to check things out and it actually nowdays is quite easy to get a miner running on FreeBSD.

Well get a basic bitcoin generator and wallet running is quite easy:

First upgrade ports (The bitcoind port was recently updated), and then install bitcoind.

# portsnap fetch update

# cd /usr/port/net-p2p/bitcoind

# make install

When the config screen you have a option to enable the GUI or not. Since the port only installs bitcion (The command with GUI) or bitcoind (The command without GUI) you will have to decide which is best for you. I clearly prefer the version without GUI so it can be started in /etc/rc.local and run in the background.

When the install is done you have a bitcoin miner and wallet to run. Play a bit with it, but don’t use it!

Why? Well CPU mining is so slow that it will take for ages to get a bitcoin payout. I’m talking about years!

So instead join a mining pool. A mining pool is a service where serveral miners join forces and split the rewards when they mine a block of coins. In this way you will receive a small portion of the payout in proportion to how much you have contributed towards the block. The downside is that bitcon or bitcoind does not support joining bitcoin pools. So lets install another (Actually more efficient) miner. The one i have experimented with is called minerd and unfortunatly there is no port for it.

So this is what you need to do to get it up and running:

Upgrade ports:

# portsnap fetch update

Install jwasm:

# cd /usr/ports/devel/jwasm

# make install

And curl:

# cd /usr/ports/ftp/curl

# make install

Now it is time to download, patch and install minerd:

% wget

% tar xvf cpuminer-1.0.tar.gz

% cd cpuminer-1.0

Now some magic to get it running.:

Edit and find the follwing row:

DEFAULT_INCLUDES = -I.@am__isrc@

And change it to:

DEFAULT_INCLUDES = -I.@am__isrc@ -I/usr/local/include

A file missing on FreeBSD is byteswap.h, but since it is just some small static inline functions jsut download it into the current directory:

# wget

Now we are ready to run configure and compiling the source:

# setennv CFLAGS “-O3 -Wall -msse2”

# ./configure

# make



This should have gone ok with a couple of warnings. Now we can run the miner with the following command:

% ./minerd –algo 4way –threads 2 –url –userpass USER.XXX:PASS

(This example is for running against the server at and you will need to register before your work will count towards generating bitcoins.)

And please note the –algo switch, there is several sha256 implementations to choose inbetwen. Do a couple of runs and check wich one is fastest on your machine. Now give it some time and you can start seeing the bit-cents rolling on your mining pools statistics page.

Anything strange? Or any questions or feedback? Please drop a comment here and i’ll try to help you out.


  1. 6 Responses to “How to run a bitcoin generator on FreeBSD”

  2. Great little introductory Youtube Vid from WeUseCoins.Com on the Concept of Bitcoins.

    By BitCoin Junkie on Jun 11, 2011

  3. # cd /usr/ports/dev/jwasm

    should be

    # cd /usr/ports/devel/jwasm

    By efk on Jun 15, 2011

  4. So from what I understand there is no GPU miner for FreeBSD yet? 🙁 Pity.

    By Lyubomir on Jun 16, 2011

  5. @efk: Thanks! Now updated.

    No GPU miner that i have heard about, but it shouldn’t be so hard to get one going. I just don’t have a card to play with.

    By admin on Jun 16, 2011

  6. As far as I read, there is no OpenCL in FreeBSD yet. The native NVIDIA drivers provide CUDA, but the existing miners out there only try to use OpenCL. The ones with CUDA are Windows and GNU/Linux only. There is source, but I don’t know how to compile it:

    By Lyubomir Grigorov on Oct 6, 2011

  7. Use this one for CPU mining:

    wget –no-check-certificate

    unzip this
    cd to the directory unzipped


    Above article has misspelled the setenv

    Use this:
    setenv CFLAGS “-O3 -Wall -msse2”

    Then as per the article above do the same:
    Edit and find the following row:

    DEFAULT_INCLUDES = -I.@am__isrc@

    And change it to:

    DEFAULT_INCLUDES = -I.@am__isrc@ -I/usr/local/include


    Your minderd should be ready 🙂

    I am on AMD64 FreeBSD 9.1

    I have no idea how to test which algo works better on my CPU.How to find that out??

    By CitBoin on Apr 13, 2013

Post a Comment