TL;DR: It’s possible to mine Ethereum on a M1 Mac GPU. Hashrate is about 2Mh/s.
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.
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
You may want to try
cmake .. -DETHASHCUDA=OFF -DBINKERN=OFF
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
Edit: I am using macos(imac)
That worked, thnx
Hi, I want test ETh mining on my MacBook Pro M1, can help me start?
A precompiled version is uploaded to GitHub on the release page.
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 😅
A precompiled version is uploaded to GitHub on the release page.
Sorry but the precompiled version for me after download is not launching:
./ethminer-m1
zsh: unknown file attribute: 1
Any idea ?
OK forget me … chmod +x solved it 😉 Thanks for your job …
i faces same, how to fix it pls.
I’m getting permission denied. What do I do?
Can you elaborate? What error do you see? Note that the precompiled binary only works on a M1 Mac.
Hello!
Nice work
Is it possible to meke it work on macos bigSurf with 5700xt gpu on it?
I think the original ethminer works for your system.
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.
Any ideas on how to adapt the solution for using AMD GPU?
It won’t work by default due to opencl issues. Need to recompile it.
can you fix DAG size for AMD 5500m 4G pls
is the Apple M1 GPU VRAM is 10GB?!!
can you fix the dag size issue for AMD 5500m 4GB?
Hi, what are the command lines to compile?
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
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?
Would you mind sharing your binary again?
Here you have https://we.tl/t-yqpNOlfh4c
Note: I have not verified the link. Use at your own risk.
That hashrate doesn’t sound right. The GPU is more powerful than that. Could it be because it thinks it is an Intel GPU?
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.
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.
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?
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?
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?
I have the same Mac Pro 2013
Can you let me know how did you compile and build? I got errors when linking.
If I use Bootcamp windows, ethminer doesn’t really work neither. Only lolMiner works, so maybe we need to compile lolMiner.
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.
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.
Can you share your compiled version? I have Mac Pro with rx580 so I can try it
If your rx580 is 8gb ram you can using official ethermine on GitHub
@amorajaber5739 The official one won’t work on Catalina or later MacOS. Due to Apple dropped support for OpenCL
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 …
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.
A week later, 24×7, nothin’. Perhaps I need to tweak something instead of using the pre-compile.
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
Does anyone think this will work with the M1 pro or M1 max?
Yes I try on my M1 max it goes to 10mh
Oh no must be more than 35mh
With the New M1 Max chip comes out. Will you dev a optimise version for it?
Oh no! Must be more than 30mh
This is really awesome, is there a way to get this to mine Ethereum Classic also?