A PHOTO
Bitcoin Mining with cgminer on OSX

Here is a quick guide to what you’ll need in order to start mining Bitcoin on OSX using CGMINER. I’ve cobbled this all together form a bunch of trial and error, so it might not be the “best” way to do things.

tl;dr

Don’t feel like messing around with all of this stuff? Dr. Haribo runs BitMinter, a great mining pool with it’s own Java based miner. It has support for a bunch of stuff right out of the box, and run’s with just a few clicks. You should check it out, it’s got cool gauges and everything!

I’ve also got the pre-compiled (Mac Mini Server/OSX 10.4.7) binary from my machine here:

CGMINER 2.4.2 - ReadMe

Read the notes, there are still some things that need to be installed for it to work.

On with the show…

You need the drivers for the usb/serial connection your FPGAs use. In my case, it was the Future Technology Devices Drivers that the ButterflyLabs BitForce Singles uses. I used the Virtual Com Port Drivers, and they work pretty well. If you do not have the proper drivers installed, you may not be able to find your devices under /dev/.

You also need to install Xcode.

You are also going to need MacPorts or HomeBrew in order to install dependancies. I’ve installed both, and found that MacPorts works 99% of the time.

For MacPorts, I used this method to install.

For HomeBrew, I used the first method to install.

Make sure everything is updated before continuing (sudo port selfupdate for MacPorts, and brew update for HomeBrew.

I can’t remember what packages I installed in what order or what dependancies they required, so here is what I have installed in both. I’ll fix this whenever I reformat the computer and start from scratch.

MacPorts [port installed]

autoconf @2.69_0 (active)
automake @1.12_0 (active)
binutils @2.21_0 (active)
boost @1.49.0_0 (active)
bzip2 @1.0.6_0 (active)
curl @7.25.0_1+ssl+universal (active)
curl-ca-bundle @7.25.0_0 (active)
cyrus-sasl2 @2.1.23_3+kerberos (active)
db48 @4.8.30_0 (active)
expat @2.1.0_0+universal (active)
flex @2.5.35_1 (active)
gdbm @1.10_1 (active)
gettext @0.18.1.1_2+universal (active)
glib2 @2.32.3_0+universal (active)
gnutls @2.12.11_1 (active)
gperf @3.0.4_2+universal (active)
help2man @1.40.5_3 (active)
icu @4.8.1_0 (active)
jansson @2.3_0 (active)
jpeg @8d_0 (active)
libffi @3.0.10_2+universal (active)
libgcrypt @1.5.0_0 (active)
libgpg-error @1.10_0 (active)
libiconv @1.14_0+universal (active)
libidn @1.22_0+universal (active)
libpng @1.4.11_0 (active)
libtasn1 @2.11_0 (active)
lzo2 @2.05_1 (active)
m4 @1.4.16_0 (active)
miniupnpc @1.6_0 (active)
ncurses @5.9_1+universal (active)
ncursesw @5.8_0 (active)
openssl @1.0.1c_0+universal (active)
ossp-uuid @1.6.2_0 (active)
p5-locale-gettext @1.50.0_6 (active)
p5.12-locale-gettext @1.50.0_6 (active)
perl5 @5.12.3_1+perl5_12 (active)
perl5.12 @5.12.4_0 (active)
pkgconfig @0.26_1+universal (active)
pv @1.2.0_0 (active)
qemu @1.0.1_0+target_i386+target_x86_64 (active)
qrencode @3.1.1_1 (active)
readline @6.2.000_0 (active)
texinfo @4.13_2 (active)
xz @5.0.3_0 (active)
yasm @1.1.0_0 (active)
zlib @1.2.7_0+universal (active)

HomeBrew [brew list]

autoconf
automake
c-ares
curl
libusb
pkg-config
wget

I had some issues compiling and bungled that all up by using both MacPorts and HomeBrew trying to get CURL to work right. Eventually, I settled on just using MacPorts, and it installed correctly (sudo port install curl +universal). If something doesn’t work right for your architecture, I found that adding in +universal helps sometimes (at least in the case of CURL).

DO IT

At this point, that should be everything you need in order to get and compile cgminer. Go ahead and pick it up via git:

cd ~
mkdir Build
cd Build
git clone https://github.com/ckolivas/cgminer.git
cd cgminer

You should be in the cgminer directory and can start putting it together.

./autogen.sh
./configure CFLAGS="-O3" --enable-bitforce
sudo make install

There are a number of flags you can add, depending on your configuration. Check out the CGMINER ReadMe for more info.

So far, so good…

You should have everything ready to start mining now, if the compilation worked. It should have installed cgminer in the /usr/bin/ directory, so you can run it from the command line. Try it out, see if it even starts. If it does…

I prefer to create a seperate directory like ~/Mining/ to keep my configs and startup scripts in.

My mining script (~/Mining/cgminer.sh) looks like this:

cgminer -S /dev/cu.usbserial-000012FD

So all I need to do is add in a scan for each of my FPGAs, in this case just one (-S /dev/cu.usbserial-000012FD). You can see which ones are available by doing a ls /dev/*usb* from the terminal, but this only works if you installed the drivers.

Oh, and dont forget you’ll have to chmod any scripts you want to run from the command line, otherwise they won’t work.

cd ~/Mining/
sudo chmod 755 cgminer.sh

Then, whenI want to start mining, I simply call it from the command line like this:

cd ~/Mining/
./cgminer.sh

My cgminer config (~/Mining/cgminer.config) looks like this:

{
"pools" : [
	{
		"url" : "http://www.MININGPOOL.com:PORT",
		"user" : "USERNAME",
		"pass" : "PASSWORD"
	}
]
,
"api-port" : "4028",
"expiry" : "120",
"gpu-dyninterval" : "7",
"gpu-platform" : "0",
"gpu-threads" : "2",
"log" : "5",
"queue" : "1",
"retry-pause" : "5",
"scan-time" : "60",
"shares" : "0",
"kernel-path" : "/usr/local/bin",
"no-submit-stale" : true
}

You can add in whatever switches or options you want to use here, just check the CGMINER ReadMe for more info.

That’s All Folks!

Hopefully this helps. When I started this, there was ZERO information available online to get these working, and through the help of a bunch of the guys on FreeNode’s #Bitcoin-OTC, #Bitcoin-Mining, and Dr. Haribo (Who happens to run BitMinter.com), I was able to get things working. A big help as well was being able to cruise through the forums at BitcoinTalk.org.

  1. bitcoinpoet reblogged this from phraust
  2. phraust posted this