This post is a little OT so I’ll keep it terse. The goal is to perform LTC mining on OSX Maverics 10.9.2. But here’s the challenge – compile everything natively from source code, on old equipment. There are several good packages and binaries floating around which you should try first. If you prefer to know what’s in them and how they’re built, here’s a step by step tutorial to roll your own. Most of the documentation for this exercise is buried in obscure forum threads and uses the Homebrew package manager. This post is for MacPorts users; and those still running MacBooks from mid 2009(!) and because I enjoy a GNU challenge…
Your first task is to identify your graphics card with the help of the Apple website and check it supports OpenCL. In my case, it’s a rather sucky NVIDIA GeForce 9400M. It seems the System Preferences, Displays Tool in Maverics can’t identify some of these older graphics devices. Once you know your graphics hardware supports OpenCL, the process is as follows:
1. Select an online mining pool and open an account. You’ll need to setup a “worker” with a username and password.
2. Update your MacPorts package manager (or install it if you don’t have it).
sudo port selfupdate
sudo port upgrade outdated
3. Check your Xcode Command Line Tools are working so you can actually run the compiler. If you haven’t installed Xcode you can grab it (free) from the OSX App Store.
Try this on something older than Maverics (like Lion or Snow Leopard)
4. Install all the lib dependencies (C header files) needed to compile bfgminer. Looking at the README around lines 84-86 you can see what you’ll need to install. Start at the beginning of the list and work through like so,
sudo port install libusb
sudo port install libevent
sudo port install libmicrohttpd
Ignore (but note) any errors as MacPorts doesn’t have packages for all these. In these cases you’ll have to install them do by hand. Create a working directory,
mkdir ~/Miner; cd Miner; ls
To install uthash headers, clone them from the git repo,
git clone https://github.com/troydhanson/uthash
Then copy thee C headers (.h files) to /usr/local/include
sudo cp ./uthash/src/*.h /usr/local/include
The process for the hidapi drivers for USB devices is a little different. I include these in case you want to try your hand at SHA-256 based crypto currencies and deploy a USB ASIC.
git clone https://github.com/signal11/hidapi
sudo make install
5. Now, the coin miner itself. I chose bfgminer, as Scrypt based LTC is no longer supported by cgminer. Clone the git repo into your working directory,
git clone https://github.com/luke-jr/bfgminer
cd ./bfgminer; ls
Run the autogen.sh script. Not clear what this does but it appears to run GNU autoconf and generate a Configure script.
Next, run the Configure script.
./configure --enable-scrypt --enable-opencl CFLAGS=”-g -O2 -Wall”
Now, compile and read but ignore any Warning messages.
sudo make install
Create a bfgminer config file called bfg.conf. This is a json file and can look something like this example. Obviously, enter the specific details of the mining pool you registered with –
"pools" : [
"url" : "stratum+tcp://crypto-coin-pool.com:3335",
"user" : "<worker_name.worker_number>",
"pass" : "<worker pwd>",
"pool-priority" : "0"
Start things up with,
./bfgminer --scrypt -c ./bfg.conf -w 128
The explanation for the -w 128 can be found here. It’s to do with the sucky performance capabilities of the GeForce card. With any luck, your bfgminer will start up…
If it doesn’t find your GPU device you’ll need to configure it with the [M]anage devices option (press “m”, obviously). Then hit the “+” sign and enter “auto”.
With any luck, you should be good to go…
Now let it run for a while… In this example it ran for 21:33 mins:secs before anything meaningful started showing up.
You can see (red boxes) submitted work packages being accepted by the online mining pool. You can expect to see these every 3 mins or so.