Bitcoin Mining on Mac OS X – cgminer & bfgminer


In my previous two posts in this series I introduced two easy-to-use bitcoin miners for OS X: BitMinter and GUIMiner. However, while these miners are relatively easy to install and use, they do not offer the best performance when it comes to hash rates. For that you’ll want to look at cgminer and bfgminer. These are native C miners and, paired with the right kernels, their performance exceeds the other two miners by quite a wide margin.

cgminer & bfgminer

The bfgminer project is a fork of the cgminer project. Now, I have no dog in this fight, but my understanding is that the teams aren’t on great terms. However, I have had good luck with both tools and have worked with both authors in order to fix a crash (cgminer, bfgminer) related to multiple GPU’s on OS X and have no complaints whatsoever. Both miners offer similar performance in my experience.


1. Xcode
To get started, you will need to install the Xcode. Xcode is a free download from the Apple App Store.

Xcode on App Store

2. Command Line Tools
Next you’ll need the Xcode Command Line Tools. Launch Xcode and then click the Xcode>Preferences menu item. Click the Downloads tab and then click Install next to Command Line Tools.

Xcode Downloads

If the text next to Xcode Command Line Tools says Installed, carry on to the next step.

3. Homebrew
Next you’ll need to install Homebrew. Homebrew is a package manager for OS X that provides a sane way of installing *nix tools, libraries, and their dependencies. It is similar to MacPorts for OS X or apt for Linux. Installing Homebrew is super-easy. Open up and run the following command (from the Homebrew homepage):

ruby -e "$(curl -fsSL"

After you install Homebrew, make sure you run the following command (as the installer should instruct you):

brew doctor

Make sure you address any errors or warnings before proceeding as they may prevent the miners from installing.

4. Miners
In my previous post I indicated that it was necessary to compile cgminer and bfgminer from their source code in order to install them on OS X. While that was necessary at the time, after some reading and experimenting with Homebrew I was able to create packages (called formulas with Homebrew) for installing cgminer and bfgminer on OS X 10.8. Once Homebrew is successfully installed, you can run the following commands to install cgminer and bfgminer:

brew tap nwoolls/xgminer
brew install cgminer

brew tap nwoolls/xgminer
brew install bfgminer

If you specify the –HEAD (two dashes) parameter for brew install then the latest source-code will be pulled for the miner from Github rather than using the latest official release.

You can visit the Github repository to view the package contents.

If you run into errors installing the above formulas you can try running brew install with the –debug –verbose parameters to find where things went wrong. I’d also recommend using brew doctor to diagnose any issues.


Both cgminer and bfgminer are command-line utilities. You can either run them without any command line parameters and fill in the prompts for mining pool URL and credentials or you can use the following format to specify your pool:

cgminer -o http://pool.url:port -u username -p password

bfgminer -o http://pool.url:port -u password -p password

If you have multiple graphics cards you’ll want to use the –no-opencl-binaries parameter with bfgminer to avoid a crash on startup. This is not necessary with cgminer as it detects OS X and applies the same workaround automatically.

Other notable command line parameters are -I (for intensity) and -k (for kernel). If you pass in -I d then the miner will use less resources so you can use your PC (think D for Desktop). Passing in -I 9 is a safe value for having the miner use as much of your graphics resources as possible to mine. Your PC will be much less responsive. Finally, -k lets you specify a kernel. I find on OS X that using -k diablo gives the best performance. So, my command-line using cgminer with the BitMinter pool would look something like this:

cgminer -k diablo -o -u username_workername -p password -I 9

cgminer Hashing

And for bfgminer:

bfgminer -k diablo -o -u username_workername -p password -I 9 --no-opencl-binaries

bfgminer Hashing

Refer to the projects on Github for full documentation of the available command-line parameters.

As you can see from the average in the upper-left of each miner’s output, with cgminer and bfgminer I average 460 Mh/s. Compare that to 400 Mh/s with GUIMiner and 370 Mh/s with BitMinter and you can see why these command-line miners are preferred over their GUI counterparts.


These are exciting times for crypto currency, whether you’re a geek or a speculator or merely a bystander. And, while OS X is pulling up the rear when it comes to supported OS’s for bitcoin mining, hopefully I’ve demonstrated some viable options for getting your feet wet with mining on OS X. BitMinter is a great option for getting started, as it gives you both a bitcoin mining pool with low fees and ready-to-use mining software. GUIMiner is a nice option for improved performance and flexibility in mining pool choice. And, if you’ve decided mining is your thing and you want the absolute best performance out of your rig, you can’t go wrong with cgminer or bfgminer.

UPDATE: Since my original post I’ve had some great help from Bitcoin community member and blogger Kerry on how to get binaries such as cgminer and bfgminer packaged in a self-contained way. If you are interested in the shell scripts that make this possible you can check them out on Github here. I have submitted these scripts to the authors of both cgminer and bfgminer so, in the future, we may see official OS X binary distributions.

In the meantime, if you’d like to try these out instead of following the instructions above, you can download them from the Releases page here.

75 thoughts on “Bitcoin Mining on Mac OS X – cgminer & bfgminer

  1. Pingback: Bitcoin Mining on Mac OS X – GUIMiner |

  2. Pingback: Bitcoin Mining on Mac OS X – BitMinter |

  3. Pingback: On Orbit » Blog Archive » Installing CGMiner 3.1.0 on Mac OS X 10.8

  4. Pingback: Litecoin Mining on Mac OS X – CPU Mining |

  5. Pingback: Litecoin Mining on Mac OS X – GPU Mining |

  6. Deviant Kade

    first off thank you for the great tutorials for mining LTC and BTC..been consumed the past week figuring it out and still running into errors on osx Lion when trying to install Cgminer and BFGMiner.

    CG Minor Error upon install:

    Library Kade$ brew install
    ######################################################################## 100.0%
    ==> Downloading
    Already downloaded: /Library/Caches/Homebrew/cgminer-3.1.0.tar.gz
    ==> ./ –disable-debug –disable-dependency-tracking –prefix=/usr/loc
    Running autoreconf -if…
    aclocal: error: aclocal: file ‘/usr/local/share/aclocal/mysql.m4’ does not exist
    autoreconf: aclocal failed with exit status: 1

    BFGMiner Error :

    Pup-Patrol:Library Kade$ brew install
    ######################################################################## 100.0%
    ==> Downloading
    Already downloaded: /Library/Caches/Homebrew/
    ==> ./configure –prefix=/usr/local/Cellar/bfgminer/3.0.2 PKG_CONFIG_PATH=/usr/l
    ==> make install
    14 errors generated.
    make[1]: *** [bfgminer-util.o] Error 1
    14 errors generated.
    make[1]: *** [bfgminer-miner.o] Error 1
    make: *** [install-recursive] Error 1

    Any help on getting either to work? How about getting 2-Gpu’s to work in OSX? Thanks again!

  7. pete

    i have a mid 2010 iMac with ATI Radeon HD 5750 1024 MB, running Mac OSX 10.8.3 with 16GB ram
    i have successfully installed from your brew package as instructed, and i get the same error that i was getting when i compiled cgminer from source.
    As far as I can tell it is something to do with the OpenCl Framework Library I have – unusually. I have an older iMac using the same version of OSX, and the same version of XCode at home, and i can get that to run!

    uname -a
    Darwin 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64

    here is the relevant error message:

    [2013-05-20 15:45:08] Probing for an alive pool
    [2013-05-20 15:45:09] Error -11: Building Program (clBuildProgram)
    [2013-05-20 15:45:09] :51:16: error: attribute requires exactly 3 arguments
    __attribute__((reqd_work_group_size(WORKSIZE, 1, 1)))

    [2013-05-20 15:45:09] Failed to init GPU thread 0, disabling device 0
    [2013-05-20 15:45:09] Restarting the GPU from the menu will not fix this.
    [2013-05-20 15:45:09] Try restarting BFGMiner.
    Press enter to continue:


    1. thehwood

      From reading the error message it sounds like you’re not using all the the “arguments” needed to execute the “attribute”

      “You can either run them without any command line parameters and fill in the prompts for mining pool URL and credentials or you can use the following format to specify your pool:

      cgminer -o http://pool.url:port -u username -p password
      bfgminer -o http://pool.url:port -u password -p password

      If you have multiple graphics cards you’ll want to use the –no-opencl-binaries parameter with bfgminer to avoid a crash on startup. This is not necessary with cgminer as it detects OS X and applies the same workaround automatically.”

      Either just put in “cgminer” or if you’re using attributes you need “cgminer -o _ -u _ -p _”.

      1. pgee70

        Hi, and thanks for the reply. I do parse those parameters in. Recently I wiped the mac, reinstalled everything from scratch, and using macports complied cgminer 3.2.1. ran it, worked fine for a day. Then I restarted, and it gave the same error again. The cgminer developer wrote on IRC it is something to do with the implementation of OpenCL in the Mac OS. But I can’t see it when what I experienced happened.

  8. Pingback: Bitcoin & Litcoin Proxy Mining on Mac OS X |

  9. Manoel Lemos

    Hi,I created an account on BitMinter and it used my Google Account to log me in. So, in the command line when invoking the mining software I have to use my Google Account password as the parameter? Is this how it works?

    1. nwoolls Post author

      No. On the BitMinter site go to My Account > Workers. From there create a new worker by specifying a name and password. Then, when mining, you pass in username_workername to login and the worker’s password.

    1. nwoolls Post author

      Unfortunately this is not easy to do. bfgminer now depends on something called uthash-dev ( and there are no Homebrew packages for that library. You can try using cgminer instead. That formula is now for the latest version. Or, if you can get the author of uthash to include a formula for his library in Homebrew I can update the bfgminer formula to the latest version.

    1. nwoolls Post author

      Hi there. I’ve updated the cgminer Homebrew formula to install cgminer 3.2.2. You can run the command linked in the article, replacing “install” with “upgrade”.

  10. Pingback: Bitcoin Mining on Mac OS X – ASICs |

  11. Will

    I’m having an issue where I believe I’m connecting to the pools but, on their websites, it doesn’t show any activity. I’m not sure what I’m doing wrong.

    1. nwoolls Post author

      Some times the stats shown for hashrate on the pool will be inaccurate, especially if your hashrate is low. They may also take some time before they start showing your statistics.

  12. pokstar

    I didn’t expect anything fabulous but didn’t expect nothing. I guess the Macbook (late 2011) is a terrible fit for this kind of business. So far I was able to reach (avg):78.55Mh/s using the an ATI 6750.

    But it was entertaining to do, thanks!

  13. rye

    Figured out how to do this – one thing I can’t figure out how to do is to disable the GPU mining. I’m using it with a Block Erupter, but don’t want the GPU to be mining. is this possible?

    1. nwoolls Post author

      If that’s the case check the links at the bottom of the post for support threads for the individual miners. Sounds like a bug to me. From the docs:
      –disable-gpu|-G Disable GPU mining even if suitable devices exist

  14. Al

    I will try this as well, and report back.

    Where would you enter this string?

    I too, want to disable the GPU and use the ASICs.

    1. Al

      I found your tutorial information and it works perfectly. I was able to disable the GPU and just use the ASICs. Thank you!

  15. nOOn

    Hi! Thanks a lot, your tutorials made my day!!
    I’m currently mining with the only Bitminter client because I’m scared that Cgminer could be using all my graphic cards and CPU too, as I’m on a laptop (MacbookPro 2009) and don’t want it to burn! So is there any option to mine with only Asicminers?

  16. mercurialkitten

    Thanks, nwools, you’ve certainly helped me thus far! But when I type in the –disable-gpu argument when launching cgminer, it says command not found.

  17. nOOn

    Ok thanks a lot, so I gave cgminer a ride with your tutorial but unexpected librairies (.dylib) are found by the brew doctor and I don’t know how to locate and delete them. maybe you’ve got some script for this?

  18. mercurialkitten

    Thanks! Also, when you specify -head parameter for brew install, it still pulls 3.3.0, not 3.3.1 of cgminer. I only mention this because I’m still having trouble getting it to recognize BFL ASIC, so I decided to reinstall newest version. I appreciate your help!

  19. nOOn

    Hi Nathan,
    Now cgminer is running good, but I’m only getting a 318 Mh/s hashrate max?
    I think with Bitminter it’s been more like 335,9 Mh/s so what have I done wrong?
    I used : cgminer -k diablo -o -u username_workername -p password –disable-gpu.
    But there are less rejected blocks so I guess it may be more profitable.
    Anyway you really helped, thank you.

    1. Al

      Mine is running well also. I too am getting a hash rate of about 318 Mh/s on the Mac as compared to 336 Mh/s on a Raspberry Pi. The Raspberry Pi crashes frequently though with cgminer 3.1.1 since I added a second USB ASIC (It was stable with just one). The Mac is completely stable so far.

  20. Al

    I read this in the cgminer README: Any thoughts? Is this reality for OSX?

    Q: Can I mine with cgminer on a MAC?
    A: cgminer will compile on OSX, but the performance of GPU mining is
    compromised due to the opencl implementation on OSX, there is no temperature
    or fanspeed monitoring, and the cooling design of most MACs, despite having
    powerful GPUs, will usually not cope with constant usage leading to a high
    risk of thermal damage. It is highly recommended not to mine on a MAC unless
    it is to a USB device.

    1. nwoolls Post author

      Here are my thoughts.

      First of all, I have used the same Mac Pro to mine under both Windows and OS X. There is no speed difference with the Open CL implementations. It is true that there is no temperature monitoring and that you cannot overclock and tweak the GPUs under OS X. If you get into mining and like it, I’d suggest building a dedicated Windows mining rig. As far as the cooling design, it really depends on the model you are using. I have a Mac Pro with a regular case design so that’s not an issue for me. I wouldn’t personally GPU mine on a Mac laptop 24×7.

      Finally, with ASICs becoming more popular, these can be used on a Mac just like on a Windows PC without any of the above limitations or considerations.

      1. nwoolls Post author

        I have and it didn’t work. The 6870 works out of the box but not the Sapphire 7950 I tried. I know there are some 79X cards for Mac Pros but they are expensive and also require power that the Mac Pro may not be able to handle with the stock PSU.

      2. Al

        Could LAN network traffic shaping effect hash rate reported on the mining pool website? My Mac shows about double the hash rate for the asicminers versus what is reported in the pool. Take a MacBook to a coffee shop and the rates match more closely. Maybe I need a pool that supports port 80? Can the network manager slow down stratum traffic? Thanks!

      3. nwoolls Post author

        Not that I am aware of. My research has led me to understand that mining should require minimal bandwidth. Try monitoring the WU value shown in cgminer or bfgminer over time. That should be your most accurate number. It is my understanding that the hashrate displayed by pools is never as accurate as the hashrate displayed by the miner.

      4. Al

        I will try looking at WU value, it seems odd thiugh that the problem is solved by using a different Internet connection.

    1. nwoolls Post author

      Yup I think it was Lion that introduced native drivers for the 68XX stuff from ATI/AMD. I have a Sapphire HD 6870 (regular PC model) and it works fine with a couple of exceptions. First, you will get a black screen during boot instead of gray. Second, you may need to order this cable from Amazon as it takes 2 PCI-E cables and my 5770 only had 1 installed.

      With this cable you can run both the stock 5770 and the 6870 at the same time.

  21. Al

    Thank you, I’ll check it out. The 5870 looks faster on some benchmark charts — the mac version is still very pricey. I bet the 6870 uses less W and runs cooler?

  22. nOOn

    If you wanna better performance with an ASIC unit, Sapphire batch, up to 335Mh/s : use the ” –icarus-timing short ” parameter.
    Also have a look on KnCminers, they’re coming soon too. Anyway, thanks guys, you really helped.

      1. nOOn

        But it seems newer versions from cgminer include this code and that if you specifiy this in your exec file, it will result in making it fail. So let’s forget about it…

  23. Pingback: Bitcoin Mining on Mac OS X – cgminer & bfgminer | |

  24. Ben Cook (@Skitzzo)

    Things were going swimmingly with CGMiner until this evening when things started freaking out.

    Can anyone provide the command line I would need to update CGMiner to 3.3.4?

    I saw the link at the bottom of the post but I don’t know what to do with those zip or tar files. (sorry for the complete noob question)

  25. nOOn

    Hello Nathan, I thought I had missed some something with the newest installation of cgminer I made, because I got only errors : AMU 0 TIME OUT …
    So I reinstalled my OSX. Nothing better. But 3.3.1 was working! So I finally ended on the main forum talking about Mr. Olivas ‘ program, I found this from himself : “Request from me to anyone having trouble with ICA or AMU devices on linux with the latest cgminer.
    Firstly, I’ve written a standalone program, that’s all the necessary code from cgminer (with lots of changes and added code) to test libusb on anyone’s linux
    It’s here:
    It has instructions in the top how to compile it.

    Running it will simply show you if the version of libusb on your linux is … problematic … but of course only if you have 2 or more ICA or AMUs

    If anyone does this could they report 4 things in a pastebin or similar link (pastebin is here: )
    Report their hardware (e.g. an intel/amd desktop, an RPi, or some other such description)
    Report their linux verion with uname -srvmpio
    Report their libusb version e.g.
    RPM based system: rpm -qva | grep libusb
    APT based system: apt-cache policy libusb-1.0 | egrep “^l|Install”
    Pacman system: pacman -Q | grep libusb
    Report their libusb libraries e.g. maybe something like: ls -las /lib*/libusb* /usr/lib*/libusb*
    and finally the output of running ./usbfail
    You may need to run it a few times – basically what’s of interest is the most common result running it.
    If it locks up in “flushing” and says it failed on exit after ~17s then that’s the expected result for a bad libusb version

    An aside – you can run ./usbfail lock and it should actually report USB working even if it fails without using lock
    It was simply a test to see if serial access to all usb IO solved the problem

    You can (if you are inclined) also compile it against a working libusb and that should make usbfail work as expected also
    To do this is something like:
    In the cgminer directory, create a libusb directory mkdir libusb
    Then cg libusb
    Then in that directory extract the archive from:
    Get libusb
    e.g. tar -xvf libusb-1.0.16-rc10.tar.bz2
    Then cd libusb-1.0.16-rc10
    Then ./configure
    You also need udev development files so will get a configure error if they aren’t installed
    Then make
    So you’ve now built libusb and can compile usbfail and link against it as shown in the 2nd example in the top of usbfail.c

    Of course none of this will fix cgminer for you, but really what I’m looking for is the answer to an on going problem to decide how to fix it.
    It would appear it would be good to add a libusb folder in with cgminer and put a working version of it in there and compile cgminer against it and thus know that cgminer is always using a working version of libusb

    None of this has anything to do with windows.”

    Ok Thanks Mr. Olivas, but what about Mac users??? Can you do something Nathan about recompiling with the new libsub pleaaaaase?

  26. Valanis

    Hi nwools,
    first thanks a lot for the great help!
    Guess I would have never been able to install without it …
    Try bfgminer on 2 systems (Mac OSX & Windows),
    in both cases it crashes from time to time …
    I know this is very unspecific, but any idea … (?)
    Kind regards

  27. Stephen Heminger

    Thanks for all the instructions. I have followed them and my asic processors are running without any problems for some time now. The only problem I have run into is when I save the configuration file in bfgminer, bfgminer will give a “bus error 10” when I try to start bfgminer again. The solution was to remove the configuration file with rm -rf .bfgminer/. Then it worked as before.

  28. Stephen Heminger

    I would like to try running bfgminer solo. All the instructions I find are for mining with pools. I don’t understand what url to use solo, and I don’t understand the use of the username and password. Am I making these up to be used in some way I have yet to understand? So I need help with.. I guess, just about all of it. And the syntax. I’ve tried many thing and bfgminer always comes up with some excuse to not run.

  29. BF

    Dude, you’ve helped me so much before I’m hoping you can help me now. My setup of 3 eruptors is great but now that I added my jalepeno it was worknig fine for a while but I was getting some kind of exception 11, so I switched pools then I got AMU1 read1 buffering 4 extra bytes and now trying to restart I’m getting runtime stats of all zeros then cgminer seems to just stop. Please help.

  30. Kevin

    How do you suggest I solve this error:

    Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
    If you didn’t put them there on purpose they could cause problems when
    building Homebrew formulae, and may need to be deleted.

    Unexpected .pc files:

  31. kscholtens

    Hi Nate – you should consider forking your branches. The Litecoin version of cgminer with scrypt support is not in the latest version of cgminer and so many of your scripts were broken because of this. I had to go through and manually work through your build scripts and such. The brew instructions are broken too.

    1. nwoolls Post author

      What about the brew instructions are broken?

      If you want scrypt support I would recommend using bfgminer rather than cgminer. cgminer has dropped GPU and scrypt support.

  32. stk

    Hi, I am having trouble with getting low hashing with cgminer on a MacPro with a NVIDIA GeForce GTX 285 and an ATI Radeon HD 5770. I only see 12.90M/13.32Mh/s and 1.584M/2.167Mh/s respectively. I am using cgminer 7.4.3 since it is the last version with CPU and scrypt support. I tried bfgminer, but it doesn’t recognize any of the cards in the machine. If you have any ideas I would love to hear them. Thanks again.

  33. Pingback: Bitcoin Mining on Mac OS X – cgminer & bfgminer | | Social Media Marketing 24/7

Leave a Reply to nwoolls Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s