How to mine Monero on your Macbook and tweak the source code (although you shouldn’t)

Fire up your terminal!

We will need git, brew and a text editor so go ahed and get them if needed. Once ready here are the commands:

brew installing a library
cmake is checking that your machine has all the dependencies ready and then outputs the configured files
make will actually compile the source code on your machine and create the executables
miner is failing because of missing configuration parameters
  • opencl-platform is the parameter where you have to put the number coming form the previous command (for me it was “#0: Apple”, so 0)
  • url is the url of you mining pool, mining alone is a bit longer story so we’ll skip that, pool.minexmr.com has ok ping for european users.
  • user and pass are typical of the mining pool, in pool.minexmr.com you have to use “Monero address” + “.” + “Monero payment id” as user and anything as password. If you don’t change those you’ll be mining for me, so please change them!
  • donate-level is a parameter saying how many hashing power you are giving for the author of the miner. Can be set to 1 (meanint 1 minute out of 100 minutes of mining).
  • intensity and worksize are describing the batch of hashing jobs that are sent for work at the GPU, we don’t go into details here since anyway you should not mine on a Macbook. For the curious here there’s a couple of recent threads with a concise explanation and some tuning: https://github.com/xmrig/xmrig-amd/issues/8 https://github.com/MultiPoolMiner/MultiPoolMiner/issues/580
config.json
Only 1 GPU is active, we’ll fix that in a minute..
config.json for double GPU usage

Edit the source code for more features

As you see the software is using by default the Intel card and we had to guess the other id, I will just show you how to modify the command print-platforms to also show all the available devices. In OpenCL the platform identifies the vendor, for each platform you can have more devices.

Inside the src folder you can find the files we need to modify
Original version of printPlatforms()
Evil-modified version which also prints all devices for each platform
print-platforms is now also displaying the devices.. form here on, dragons may appear.

Fun Facts

  • https://github.com/xmrig/xmrig-amd official repository for the miner, many thanks to the Monero community
  • There was an interesting time when the official source code of the miner was slower than what it could have been by otpmizing it. Truth be told, I am diggin it to see if the latest change of proof of work introduced some parts that can be optimized. The recap of the event, for historians, is here: https://monero.stackexchange.com/questions/858/monero-origins-optimized-crippled-miner
  • Copy and pasting from medium into your terminal may or may not work because they have fancy typography like — which should be --, just to say one, there may be more.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Thomas Rossi

Thomas Rossi

Founder, cryptography enthusiast and bitcoin-aficionado (not enough surfing)