Mining Ethereum on M1 Mac GPU

TL;DR: It’s possible to mine Ethereum on a M1 Mac GPU. Hashrate is about 2Mh/s.

Mining on a M1 Mac

I’ve had my M1 MacBook Air for a bit of time now, and I also recently started mining Ethereum. I can’t help asking myself: What’s Ethereum mining performance like on a M1 Mac?

The obvious thing to do first is to run the off-the-shelf ethminer, which gives the following error:

ethminer 0.19.0-alpha.0
Build: darwin/release/appleclang

Unrecognized platform Apple
Error: No usable mining devices found

Not good. Apparently Apple GPUs are not whitelisted in ethminer. That should be easy to fix. Relevant lines are in libethash-cl/CLMiner.cpp, and I added Apple GPUs to the whitelist, pretending it’s an Intel GPU.

Then boost won’t compile since it’s trying to compile with a -fcoalesce-templates argument, which doesn’t exist in recent clang versions. So I have to update boost to the latest version, and fix relevant asio code since ethminer was using deprecated asio APIs.

I also need to upgrade OpenSSL to the latest version to have it support darwin + arm64.

After getting everything to compile. Here’s the result:

ethminer 0.19.0-17+commit.ce52c740.dirty
Build: darwin/release/appleclang

 i 19:51:36          Configured pool eth-us-east1.nanopool.org:9999
 i 19:51:36          Selected pool eth-us-east1.nanopool.org:9999
 i 19:51:36          Connection remotely closed by eth-us-east1.nanopool.org
 i 19:51:36          Stratum mode : EthereumStratum/1.0.0 (NiceHash)
 i 19:51:36          Established connection to eth-us-east1.nanopool.org [144.217.14.139:9999]
 i 19:51:36          Spinning up miners...
cl 19:51:36 cl-0     Using Device : Intel GPU 0.0 Apple M1 OpenCL 1.2  Memory : 10.67 GB (11453251584 B)
 i 19:51:36          Extranonce set to 778d
 i 19:51:36          Extranonce set to 778d
 i 19:51:36          Authorized worker [REDACTED]
 i 19:51:36          Epoch : 397 Difficulty : 10.00 Gh
 i 19:51:36          Job: c7fc5311… eth-us-east1.nanopool.org [144.217.14.139:9999]
cl 19:51:38 cl-0     Generating split DAG + Light (total): 4.10 GB
 i 19:51:38          Job: 40a57756… eth-us-east1.nanopool.org [144.217.14.139:9999]
cl 19:51:38 cl-0     OpenCL kernel
cl 19:51:38 cl-0     Creating DAG buffer, size: 4.10 GB, free: 6.57 GB
cl 19:51:38 cl-0     Creating light cache buffer, size: 65.62 MB
cl 19:51:38 cl-0     Loading kernels
cl 19:51:38 cl-0     Creating buffer for header.
cl 19:51:38 cl-0     Creating mining buffer
 m 19:51:41          0:00 A0 0.00 h - cl0 0.00
 i 19:51:42          Job: 077b62f6… eth-us-east1.nanopool.org [144.217.14.139:9999]
 m 19:51:46          0:00 A0 0.00 h - cl0 0.00
 i 19:51:46          Job: 2835839e… eth-us-east1.nanopool.org [144.217.14.139:9999]
 m 19:51:51          0:00 A0 0.00 h - cl0 0.00
 m 19:51:56          0:00 A0 0.00 h - cl0 0.00
 i 19:51:57          Job: 97f724e7… eth-us-east1.nanopool.org [144.217.14.139:9999]
 m 19:52:01          0:00 A0 0.00 h - cl0 0.00
 m 19:52:06          0:00 A0 0.00 h - cl0 0.00
 m 19:52:11          0:00 A0 0.00 h - cl0 0.00
 m 19:52:16          0:00 A0 0.00 h - cl0 0.00
 i 19:52:16          Job: 54df0504… eth-us-east1.nanopool.org [144.217.14.139:9999]
 m 19:52:21          0:00 A0 0.00 h - cl0 0.00
cl 19:52:22 cl-0     4.10 GB of DAG data generated in 44,060 ms.
 m 19:52:26          0:00 A0 184.16 Kh - cl0 184.16
 m 19:52:31          0:00 A0 1.96 Mh - cl0 1.96
 m 19:52:36          0:01 A0 1.98 Mh - cl0 1.98
 i 19:52:39          Job: d3b1da5e… eth-us-east1.nanopool.org [144.217.14.139:9999]
 m 19:52:41          0:01 A0 1.99 Mh - cl0 1.99
cl 19:52:43 cl-0     Job: 54df0504… Sol: 0x778d000001d14c71
 i 19:52:43          **Accepted 150 ms. eth-us-east1.nanopool.org [144.217.14.139:9999]
 m 19:52:46          0:01 A1 1.95 Mh - cl0 1.95
 m 19:52:51          0:01 A1 2.07 Mh - cl0 2.07
 m 19:52:56          0:01 A1 2.00 Mh - cl0 2.00
 m 19:53:01          0:01 A1 1.98 Mh - cl0 1.98
 i 19:53:01          Job: ccc2b97f… eth-us-east1.nanopool.org [144.217.14.139:9999]
 m 19:53:06          0:01 A1 1.97 Mh - cl0 1.97
 i 19:53:07          Job: 23919d82… eth-us-east1.nanopool.org [144.217.14.139:9999]
^C i 19:53:10 main     Got interrupt ...
 i 19:53:10 main     Disconnected from eth-us-east1.nanopool.org [144.217.14.139:9999]
 i 19:53:10 main     Shutting down miners...
 i 19:53:16 main     Terminated!

Code is available at https://github.com/gyf304/ethminer-m1

Is it worth it?

Um. Not really. At current Ethereum prices (2021-02-26), it generates $0.14 of profit per day. It’s still a profit, but very miniscule.

Comments

87 responses to “Mining Ethereum on M1 Mac GPU”

  1. Flow Avatar
    Flow

    Hey .. thanks for the post. Where you using any specific version of the CUDA drivers? Looks like they have been discontinued on MacOS.

    Because during the cmake phase I get

    CMake Error at /opt/homebrew/Cellar/cmake/3.19.4/share/cmake/Modules/FindCUDA.cmake:716 (message):
    Specify CUDA_TOOLKIT_ROOT_DIR

    1. Yifan Gu Avatar

      You may want to try
      cmake .. -DETHASHCUDA=OFF -DBINKERN=OFF

      1. John Avatar
        John

        umm I am stuck at this, just like you
        ethminer 0.19.0-alpha.0
        Build: darwin/release/appleclang

        Unrecognized platform Apple
        Error: No usable mining devices found

        But how do i whilelist my Radeon Pro 560 4GB, sorry for the stupid question, I am new to mining

      2. John Avatar
        John

        Edit: I am using macos(imac)

  2. […] since the new Apple M1 Macs are super powerful and efficient, they should be great for mining crypto, right? […]

  3. […] software program engineer Yifan Gu found a way to make the ethminer utility run on a MacBook Air that includes the M1 processor. It required a […]

  4. Flow Avatar
    Flow

    That worked, thnx

  5. Mark Avatar
    Mark

    Hi, I want test ETh mining on my MacBook Pro M1, can help me start?

    1. Yifan Gu Avatar

      A precompiled version is uploaded to GitHub on the release page.

  6. Eugenio Chen Avatar

    Hi, great work! Is there any way to have a pre-compiled version? I’ve downloaded the code from github but I got lost right after, as I don’t know how to compile it. Sorry, total noob with code 😅

    1. Yifan Gu Avatar

      A precompiled version is uploaded to GitHub on the release page.

  7. herve0112 Avatar
    herve0112

    Sorry but the precompiled version for me after download is not launching:
    ./ethminer-m1
    zsh: unknown file attribute: 1
    Any idea ?

    1. herve0112 Avatar
      herve0112

      OK forget me … chmod +x solved it 😉 Thanks for your job …

      1. amrojaber5739 Avatar

        i faces same, how to fix it pls.

  8. Taka Iguchi Avatar
    Taka Iguchi

    I’m getting permission denied. What do I do?

    1. Yifan Gu Avatar

      Can you elaborate? What error do you see? Note that the precompiled binary only works on a M1 Mac.

  9. Alex Avatar

    Hello!

    Nice work

    Is it possible to meke it work on macos bigSurf with 5700xt gpu on it?

    1. Yifan Gu Avatar

      I think the original ethminer works for your system.

      1. Ruslan Gunawardana (exarus) Avatar
        Ruslan Gunawardana (exarus)

        No, it doesn’t! 🙂 macOS is abandoned by developers. Having a 2018 Macbook Pro and checked it carefully. It seems to be that some tweaks to the code should be made. Updated hunter config can be reused from your commits.

      2. Ruslan Gunawardana (exarus) Avatar
        Ruslan Gunawardana (exarus)

        Any ideas on how to adapt the solution for using AMD GPU?

      3. Solarlord Avatar
        Solarlord

        It won’t work by default due to opencl issues. Need to recompile it.

  10. amrojaaber Avatar

    can you fix DAG size for AMD 5500m 4G pls

  11. amrojaber5739 Avatar

    is the Apple M1 GPU VRAM is 10GB?!!

  12. amrojaber5739 Avatar

    can you fix the dag size issue for AMD 5500m 4GB?

  13. Solarlord Avatar

    Hi, what are the command lines to compile?

    1. Minigato Avatar
      Minigato

      I followed this guide to build for x86. https://github.com/gyf304/ethminer-m1/blob/master/docs/BUILD.md

      You should never trust a binary built from a stranger on the internet, but here is my x86 build anyways. https://we.tl/t-PpGj9KnT1M

      You will also have to chmod +x the executable.

      You probably won’t have enough VRAM to mine but you can run a benchmark with a smaller block size with this command: ./ethminer -M 100000

      1. seba88 Avatar

        Hi, I tried starting your binary on my MacPro but it gives me errors; dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
        Referenced from: /Users/sebastiaanbethlehem/Downloads/ethminer (which was built for Mac OS X 11.0) probably yours only works on macOS 11 then or am I missing something?

      2. Solarlord Avatar
        Solarlord

        Would you mind sharing your binary again?

          1. Yifan Gu Avatar

            Note: I have not verified the link. Use at your own risk.

  14. Miguel Avatar

    That hashrate doesn’t sound right. The GPU is more powerful than that. Could it be because it thinks it is an Intel GPU?

  15. Minigato Avatar
    Minigato

    Something is not right. That hashrate doesn’t make sense. My guess is that the problem has to do with the miner thinking it is an Intel GPU when adjusting its parameters. Coincidentally, my Intel HD 630 gets the same hashrate…

    The M1’s OpenCL Geekbench score is 18291 while my Radeon Pro 560’s is 16448, but this one gets 6MH/s. The HD 630’s score is 5095 with 2MH/s.

    For this tests I have used your fork recompiled for x86.

    1. Yifan Gu Avatar

      Ethereum mining (ETHash) is memory intensive. While dedicated graphics cards have fast GDDR5/6 memory, the M1 has LPDDR4X, with considerably less memory bandwidth, restricting performance.

      1. Minigato Avatar
        Minigato

        That makes some sense and explains part of the difference with the Radeon GPU. But still doesn’t explain how my LPDDR3, non “unified-memory” architecture, HD 630 gets the same 2MH/s while an Iris Plus 655 with also LPDDR3 memory gets 3MH/s.

        Shouldn’t the much faster M1 GPU get at least better results with LPDDR4X instead of LPDDR3?

  16. Vincent Avatar
    Vincent

    Hi, great work! After cd ./ethminer-m1-master/ethminer/, what should I do next? I tried ./ethminer –farm-recheck 2000 -S eth.f2pool.com:6688 -O 0xB0515F735b6112bCdd5c6dE7aECD77fb4173Bc33, but that doesn’t work. Is there any misunderstanding for me?

  17. […] Source Mining Ethereum on M1 Mac GPU […]

  18. Powerkey Avatar
    Powerkey

    Apparently, the official ethminer no longer supports macOS. I do not have an M1 Mac, but your fork has the the Apple platform entries in it, so I thought I would give it a try on my MacPro (2013). I built from source and it seemed to all work okay.

    When I tried launching, It found my AMD OpenCL cards and started to initialize, but then it aborted after creating the buffers.

    ====
    % ./ethminer -P stratum2+tcp://:[email protected]:11024

    ethminer 0.19.0+commit.5b9b7814
    Build: darwin/release/appleclang

    i 14:07:46 Configured pool gulf.moneroocean.stream:11024
    i 14:07:46 Selected pool gulf.moneroocean.stream:11024
    i 14:07:46 Stratum mode : EthereumStratum/1.0.0 (NiceHash)
    i 14:07:46 Established connection to gulf.moneroocean.stream [[2600:1f14:e05:4800:efe4:80cb:5cbc:b08d]:11024]
    i 14:07:46 Spinning up miners…
    cl 14:07:46 cl-0 Using Device : Intel GPU 0.0 AMD Radeon HD – FirePro D700 Compute Engine OpenCL 1.2 Memory : 6.00 GB (6442450944 B)
    cl 14:07:46 cl-1 Using Device : Intel GPU 0.1 AMD Radeon HD – FirePro D700 Compute Engine OpenCL 1.2 Memory : 6.00 GB (6442450944 B)
    i 14:07:46 Extranonce set to fff2
    i 14:07:46 Authorized worker
    i 14:07:46 Epoch : 404 Difficulty : 717.64 Mh
    i 14:07:46 Job: 35ca623d… gulf.moneroocean.stream [[2600:1f14:e05:4800:efe4:80cb:5cbc:b08d]:11024]
    cl 14:07:50 cl-0 Generating split DAG + Light (total): 4.16 GB
    cl 14:07:50 cl-1 Generating split DAG + Light (total): 4.16 GB
    cl 14:07:50 cl-0 OpenCL kernel
    cl 14:07:50 cl-1 OpenCL kernel
    cl 14:07:50 cl-1 Creating DAG buffer, size: 4.16 GB, free: 1.84 GB
    cl 14:07:50 cl-0 Creating DAG buffer, size: 4.16 GB, free: 1.84 GB
    cl 14:07:50 cl-0 Creating light cache buffer, size: 66.50 MB
    cl 14:07:50 cl-0 Loading kernels
    cl 14:07:50 cl-1 Creating light cache buffer, size: 66.50 MB
    cl 14:07:50 cl-1 Loading kernels
    cl 14:07:50 cl-0 Creating buffer for header.
    cl 14:07:50 cl-0 Creating mining buffer
    cl 14:07:50 cl-1 Creating buffer for header.
    cl 14:07:50 cl-1 Creating mining buffer
    zsh: abort ./ethminer -P
    ====

    Any idea what might be happening?

    1. Solarlord Avatar
      Solarlord

      I have the same Mac Pro 2013
      Can you let me know how did you compile and build? I got errors when linking.

      1. Solarlord Avatar
        Solarlord

        If I use Bootcamp windows, ethminer doesn’t really work neither. Only lolMiner works, so maybe we need to compile lolMiner.

      2. Robin Horn Avatar
        Robin Horn

        I followed the instructions for building on the official GitHub page. (https://github.com/gyf304/ethminer-m1/blob/master/docs/BUILD.md#instructions)

        I have Xcode installed, as well as the Xcode command line tools. Also, a fresh install of homebrew was installed to make sure I had the Big Sur packages.

        There were a few warnings, but no errors.

      3. Powerkey Avatar
        Powerkey

        I followed the instructions for building on the official GitHub page. (https://github.com/gyf304/ethminer-m1/blob/master/docs/BUILD.md#instructions)

        I have Xcode installed, as well as the Xcode command line tools. Also, a fresh install of homebrew was installed to make sure I had the Big Sur packages.

        There were a few warnings, but no errors.

    2. Sebastiaan88 Avatar
      Sebastiaan88

      Can you share your compiled version? I have Mac Pro with rx580 so I can try it

      1. amrojaber5739 Avatar

        If your rx580 is 8gb ram you can using official ethermine on GitHub

      2. Solarlord Avatar
        Solarlord

        @amorajaber5739 The official one won’t work on Catalina or later MacOS. Due to Apple dropped support for OpenCL

  19. levyfan Avatar
    levyfan

    Hi yifan, I got “Socket write failed : Operation not permitted” on this patch, even run as sudo, not sure what happened. Could you help me find what is going on?

    ethminer 0.19.0+commit.5b9b7814
    Build: darwin/release/appleclang

    i 15:44:26 Configured pool stratum.okpool.me:3336
    i 15:44:26 Selected pool stratum.okpool.me:3336
    X 15:44:26 Socket write failed : Operation not permitted
    i 15:44:26 Connection remotely closed by stratum.okpool.me
    i 15:44:26 Disconnected from stratum.okpool.me:3336
    i 15:44:26 No connection. Suspend mining …
    SIGSEGV encountered …

  20. Patrick Avatar
    Patrick

    I admire the patience people have when they reply to people that literaly put no effort into helping themselves. Like come on guys if you dont know the basic of linux then maybe you should start with that and then think about mining.

    Denied access …. hummm Sudo maybe ?
    Double click nothing happens ….. hum make it executable …

    like I dont want to be rude but the people who ask these question dont have respect in my opinion because when you ask a question like this youre literaly saying that your time is more valuable then mine because instead of trying to find yourself the answer you came here typed in your problem and waited for it to be solved.

    At least if the problem you were facing were somewhat complex or specific to mining I would understand but come on if you dont even know how to turn on your computer maybe you should go mine with a real pic axe and smash it right in your new mac.

  21. […] Source Mining Ethereum on M1 Mac GPU […]

  22. macmini Avatar
    macmini

    A week later, 24×7, nothin’. Perhaps I need to tweak something instead of using the pre-compile.

  23. Ryan Freeman Avatar
    Ryan Freeman

    I’m trying to build with an Intel Mac with an AMD GPU

    I’m pretty sure I’m doing the right thing on my build.
    However, I’m getting a 403 error on the BOOST program unable to download it. Would you be able to update the project.

    cmake .. -DETHASHCUDA=OFF -DETHASHCL=ON

  24. […] Yifan Gu a trouvé un moyen d’utiliser Ethermine pour miner de l’Ethereum sur Mac, mais sa méthode paraît bien plus complexe que celle que vous allez découvrir plus bas. De plus, il faut être en […]

  25. […] Mining Ethereum on M1 Mac GPU […]

  26. […] software engineer Yifan Gu found a way to make the ethminer utility run on a MacBook Air featuring the M1 processor. It required a bit of […]

  27. Edward Clark Avatar

    Does anyone think this will work with the M1 pro or M1 max?

    1. yurihung Avatar

      Yes I try on my M1 max it goes to 10mh

      1. amrojaber5739 Avatar

        Oh no must be more than 35mh

  28. yurihung Avatar

    With the New M1 Max chip comes out. Will you dev a optimise version for it?

    1. amrojaber5739 Avatar

      Oh no! Must be more than 30mh

  29. Barrie Avatar
    Barrie

    This is really awesome, is there a way to get this to mine Ethereum Classic also?

  30. […] Source Mining Ethereum on M1 Mac GPU […]

  31. […] Mining Ethereum on M1 Mac GPU […]

  32. […] Array ArrayArray […]

  33. […] Gu bemerkte auch, dass die Konfiguration seines M1 mit der Ethminer-Software nicht sehr einfach war. Dazu benötigt man Programmierkenntnisse in C++. Aber wenn Sie etwas Erfahrung in der C++-Programmierung haben, können Sie wahrscheinlich Gus Schritten auf seinen folgen offizieller Blog. […]

  34. […] Gu also noted that configuring his M1 with the Ethminer software was not very easy. To do this, one must have knowledge of coding in C++. But if you have some experience with C++ coding, you can probably follow Gu’s steps on his official blog. […]

  35. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  36. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  37. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  38. […] Gu a également noté que configurer son M1 avec le logiciel Ethminer n’était pas très facile. Pour ce faire, il faut une connaissance du codage en C++. Mais si vous êtes un peu expérimenté dans le codage C++, vous pourrez probablement suivre les étapes de Gu sur son blog officiel. […]

  39. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  40. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  41. […] Gu additionally famous that configuring his M1 with the Ethminer software program wasn’t very simple. To take action, one wants a data of coding in C++. However when you’re considerably skilled in C++ coding, you may most likely have the ability to observe Gu’s steps on his official blog. […]

  42. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  43. […] Gu additionally famous that configuring his M1 with the Ethminer software program wasn’t very simple. To take action, one wants a data of coding in C++. However should you’re considerably skilled in C++ coding, you will in all probability be capable of comply with Gu’s steps on his official blog. […]

  44. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  45. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  46. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  47. […] Gu also noted that configuring his M1 with the Ethminer software wasn’t very easy. To do so, one needs a knowledge of coding in C++. But if you’re somewhat experienced in C++ coding, you’ll probably be able to follow Gu’s steps on his official blog. […]

  48. […] bilgisine sahip olmak gerekir. Ancak C++ kodlama konusunda biraz deneyimliyseniz, muhtemelen Gu’nun resmi blogunda adımlarını takip […]

  49. […] somewhat experienced in C++ coding, you'll probably be able to follow Gu's steps on his official blog.But if you're looking to make big bucks through crypto mining, using the M1 chip isn't a […]

  50. […] somewhat experienced in C++ coding, you'll probably be able to follow Gu's steps on his official blog.But if you're looking to make big bucks through crypto mining, using the M1 chip isn't a […]

  51. […] software Yifan Gu pudo superar esa limitación mediante un proceso que explica detalladamente en su blog oficialy la verdad es que los resultados son muy claros: no merece la […]

  52. […] Gu también señaló que configurar su M1 con el software Ethminer no fue muy fácil. Para ello, es necesario tener conocimientos de codificación en C++. Pero si tienes algo de experiencia en codificación C++, probablemente podrás seguir los pasos de Gu en su blog oficial. […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.