How to mine ETH with GPU on your Mac (revised)

in #mining7 years ago

This is the revised version of my previous post how to mine eth with gpu on your mac. It showed less performance than the devices can do and only worked with minergate pool.

I've tried compiling from source code and got better result than my previous one. I'm not sure all problems are solved, but it definitely shows improved result.

Let's do it.

1. Prerequisites

  • XCode

    I'm not sure whether it must be needed or not, but I think you have to install it to build from source code.

  • Ethereum wallet address

    I've tested with ethermine pool and dwarfpool with my own eth wallet address.

Now, open Terminal app and run the following commands.

2. Install CMake

You can skip this step if you already installed CMake on your system

2.1 Install Homebrew

You can skip this step if you already installed Homebrew or other package manager

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.2 Install CMake

$ brew install cmake

3.Get source code

3.1 Go to the directory where you want to download source code

I used my Desktop folder in this post. You can change it as you want.

$ cd ~/Desktop

3.2 Download source code from git repository

$ git clone https://github.com/ethereum-mining/ethminer.git

3.3 Go to the source code directory

$ cd ethminer

4. Build from source code

4.1 Create a build directory

$ mkdir build; cd build

4.2 Configure the project with CMake

$ cmake ..

If you have NVidia GPU(s), you need to add more options

$ cmake .. -DETHASHCUDA=ON

4.3 Build the project using CMake Build Tool Mode

$ cmake --build .


You will get the result like below if you succeeded.

...
[  0%] Built target BuildInfo.h
Scanning dependencies of target devcore
[  4%] Building CXX object libdevcore/CMakeFiles/devcore.dir/CommonData.cpp.o
[  8%] Building CXX object libdevcore/CMakeFiles/devcore.dir/FixedHash.cpp.o
[ 12%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Log.cpp.o
[ 16%] Building CXX object libdevcore/CMakeFiles/devcore.dir/RLP.cpp.o
[ 20%] Building CXX object libdevcore/CMakeFiles/devcore.dir/SHA3.cpp.o
[ 24%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Worker.cpp.o
[ 28%] Linking CXX static library libdevcore.a
[ 28%] Built target devcore
Scanning dependencies of target ethash
[ 32%] Building C object libethash/CMakeFiles/ethash.dir/internal.c.o
[ 36%] Building C object libethash/CMakeFiles/ethash.dir/sha3.c.o
[ 40%] Linking C static library libethash.a
[ 40%] Built target ethash
Scanning dependencies of target ethcore
[ 44%] Building CXX object libethcore/CMakeFiles/ethcore.dir/BlockHeader.cpp.o
[ 48%] Building CXX object libethcore/CMakeFiles/ethcore.dir/EthashAux.cpp.o
[ 52%] Building CXX object libethcore/CMakeFiles/ethcore.dir/Miner.cpp.o
[ 56%] Linking CXX static library libethcore.a
[ 56%] Built target ethcore
[ 60%] Generating OpenCL Kernel Byte Array
Scanning dependencies of target ethash-cl
[ 64%] Building CXX object libethash-cl/CMakeFiles/ethash-cl.dir/CLMiner.cpp.o
[ 68%] Linking CXX static library libethash-cl.a
[ 68%] Built target ethash-cl
Scanning dependencies of target ethstratum
[ 72%] Building CXX object libstratum/CMakeFiles/ethstratum.dir/EthStratumClient.cpp.o
[ 76%] Building CXX object libstratum/CMakeFiles/ethstratum.dir/EthStratumClientV2.cpp.o
[ 80%] Linking CXX static library libethstratum.a
[ 80%] Built target ethstratum
Scanning dependencies of target apicore
[ 84%] Building CXX object libapicore/CMakeFiles/apicore.dir/Api.cpp.o
[ 88%] Building CXX object libapicore/CMakeFiles/apicore.dir/ApiServer.cpp.o
[ 92%] Linking CXX static library libapicore.a
[ 92%] Built target apicore
Scanning dependencies of target ethminer
[ 96%] Building CXX object ethminer/CMakeFiles/ethminer.dir/main.cpp.o
In file included from /Users/soon/Desktop/ethminer/ethminer/main.cpp:26:
/Users/soon/Desktop/ethminer/ethminer/MinerAux.h:729:26: warning: variable
      'completed' used in loop condition not modified in loop body
      [-Wfor-loop-analysis]
                        for (unsigned i = 0; !completed; ++i)
                                              ^~~~~~~~~
/Users/soon/Desktop/ethminer/ethminer/MinerAux.h:814:27: warning: variable
      'completed' used in loop condition not modified in loop body
      [-Wfor-loop-analysis]
                                for (unsigned i = 0; !completed; ++i)
                                                      ^~~~~~~~~
/Users/soon/Desktop/ethminer/ethminer/MinerAux.h:1071:11: warning: private field
      'm_parallelHash' is not used [-Wunused-private-field]
        unsigned m_parallelHash    = 4;
                 ^
3 warnings generated.
[100%] Linking CXX executable ethminer
[100%] Built target ethminer

Don't worry about the 'warning's.

5. Start mining

The executable file generated at ~/Desktop/ethminer/build/ethminer/. So go to that directory to run the miner.

$ cd ~/Desktop/ethminer/build/ethminer/

For dwarfpool

./ethminer -G -F http://eth-eu.dwarfpool.com/<YOUR_ETH_WALLET_ADDRES>

For ethermine pool

./ethminer --farm-recheck 200 -G -S eu1.ethermine.org:4444 -FS us1.ethermine.org:4444 -O <YOUR_ETH_WALLET_ADDRES>.<YOUR_RIG_NAME>


You should change <YOUR_ETH_WALLET_ADDRES> and <YOUR_RIG_NAME> to your own ones.

Nvidia users need to change -G to -U.

This is the result from my laptop (AMD 460).

...
  m  02:06:09|          Got work package: #8daa6843
 cl  02:06:09|cl-1      New work: header #8daa6843target 0000000225c17d04dad2965cc5a02a23e254c0c3f75d9178046aeb27ce1ca574
 cl  02:06:09|cl-1      Switch time 81 ms / 180 us
  m  02:06:09|          Speed   5.97 Mh/s    gpu/0  0.00  gpu/1  5.97  [A0+0:R0+0:F0] Time: 00:00
  m  02:06:10|          Speed   5.98 Mh/s    gpu/0  0.00  gpu/1  5.98  [A0+0:R0+0:F0] Time: 00:00
  m  02:06:12|          Speed   5.88 Mh/s    gpu/0  0.00  gpu/1  5.88  [A0+0:R0+0:F0] Time: 00:00
  m  02:06:13|          Speed   5.98 Mh/s    gpu/0  0.00  gpu/1  5.98  [A0+0:R0+0:F0] Time: 00:00
  m  02:06:15|          Speed   5.88 Mh/s    gpu/0  0.00  gpu/1  5.88  [A0+0:R0+0:F0] Time: 00:00
  m  02:06:17|          Speed   6.03 Mh/s    gpu/0  0.00  gpu/1  6.03  [A0+0:R0+0:F0] Time: 00:00
  m  02:06:19|          Speed   5.91 Mh/s    gpu/0  0.00  gpu/1  5.91  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:20|          Speed   6.01 Mh/s    gpu/0  0.00  gpu/1  6.01  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:21|          Speed   5.93 Mh/s    gpu/0  0.00  gpu/1  5.93  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:23|          Speed   5.95 Mh/s    gpu/0  0.00  gpu/1  5.95  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:24|          Speed   5.94 Mh/s    gpu/0  0.00  gpu/1  5.94  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:26|          Speed   5.94 Mh/s    gpu/0  0.00  gpu/1  5.94  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:27|          Speed   5.95 Mh/s    gpu/0  0.00  gpu/1  5.95  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:29|          Speed   5.95 Mh/s    gpu/0  0.00  gpu/1  5.95  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:30|          Speed   5.94 Mh/s    gpu/0  0.00  gpu/1  5.94  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:32|          Speed   5.95 Mh/s    gpu/0  0.00  gpu/1  5.95  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:33|          Speed   5.95 Mh/s    gpu/0  0.00  gpu/1  5.95  [A0+0:R0+0:F0] Time: 00:01
  m  02:06:35|          Speed   5.95 Mh/s    gpu/0  0.00  gpu/1  5.95  [A0+0:R0+0:F0] Time: 00:01


It shows almost 6 MH/s. It's definitely better result than from my previous post (1.5 MH/s).
The good news is that you can boost this number a little bit. I'll write about it on my next post.

For advanced users

$ ./ethminer --help

will show you more detailed options that you can tweak.

For Nvidia users

I don't have Nvidia GPUs on my Mac, so I'm not sure the followings are needed, but try installing all of them if you have any troubles.

The latest NVIDIA CUDA driver

https://www.nvidia.com/object/mac-driver-archive.html

The "web" driver appropriate for your macOS version

El Capitan: 10.11.6.

http://www.nvidia.com/download/driverResults.aspx/114670/en-us

Sierra: 10.12.3

http://www.nvidia.com/download/driverResults.aspx/117892/en-us

Please let me know

If you tried this, share your result with your hardware specs.
I know the Mac isn't the good machine for just mining purpose, but I did this for my curiosity.

Sort:  

Hi soon8013. I found your post by chance in a search for Mac mining. I want to thank you for the detailed instructions. I was able to execute your instructions quite well. And while it did not work for me due to only having 2 GB in my Radeon R9 M370X on my 2015 MBP, I saw the potential of using this on other macs. My appreciation for you is that you did the leg work to have something for Mac computers when everything else is pretty much PC with a dab of Linux. Keep up the good work. I will be following.
Thanks. P.S. I'm starting a solar powered crytpo mining project if you're interested. Cheers!

Thank you, I have errors (new to terminal) I will paste my results.

CMake Error at /usr/local/Cellar/cmake/3.9.4_1/share/cmake/Modules/FindCUDA.cmake:649 (message):
Specify CUDA_TOOLKIT_ROOT_DIR
Call Stack (most recent call first):
libethash-cuda/CMakeLists.txt:1 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Users/brucewayne/Desktop/ethminer/build/CMakeFiles/CMakeOutput.log".
See also "/Users/brucewayne/Desktop/ethminer/build/CMakeFiles/CMakeError.log".
Bruces-MacBook-Pro:build brucewayne$ cmake --build .
make: *** No targets specified and no makefile found. Stop.
Bruces-MacBook-Pro:build brucewayne$ cmake --build hh

I'm sorry that I can't answer to your question exactly because I don't have Nvidia GPU.
But try this: https://stackoverflow.com/questions/19980412/how-to-let-cmake-find-cuda
You may need to replace some path(s) to your own one.
And make sure cuda driver and web driver installed.

hi same here. Did you fixed this issue?

당첨금 전달합니다. ^^ tip! 2.076

앗 감사합니다!!!!

Thanks for this guide! I am getting 8.2MH's on my 2017 15" MacBook Pro with the Radeon Pro 560. I have a sonnet eGPU enclosure attached with the included Sapphire RX580 8gb. It is getting just shy of 19MH/s with the stock firmware. I may try flashing a different firmware for faster hashing.

One note, at 8MH/s thats about $3 per week after subtracting the cost of the about 50w of power the computer consumes. Thats pretty impressive honestly for a laptop. It really is low power. The GPU only consumes 35w. Probably less power with the display off too.

Sounds cool! Thank you for sharing your result :)

So I updated to 10.13.2 today and it lowered my performance quite a bit. I recompiled but that did not help. Went down to 7.2MH/s on the RP570 and 14.8MH/s on the RX580. Any ideas how to solve this?

Try below on terminal before starting mining.

export GPU_FORCE_64BIT_PTR=0
export GPU_MAX_HEAP_SIZE=100
export GPU_USE_SYNC_OBJECTS=1
export GPU_SINGLE_ALLOC_PERCENT=100

And it may be helpful adding '--cl-local-work 256' option to the end of your ethminer options.

That helped a tiny bit. Up to 7.8MH/s on the RP560 and 15.2MH/s on the RX580... This is just weird. The only thing that changed was the software update.

I'm sorry to say that maybe Apple has to optimize device drivers more for 10.13.2

I have almost the same set up and ran into the same issue ☹️

Tried it out. Yes you need to install XCode on your Mac and link your GitHub account.

... I did get the following error after step 4.2 and not sure how to proceed:

Michaels-MacBook-Pro:build michaelwickson$ cmake ..
-- [hunter] Initializing Hunter workspace (aafb99b93d466f963d53a39271f20d5074996cb0)
-- [hunter] https://github.com/ruslo/hunter/archive/v0.19.86.tar.gz
-- [hunter] -> /Users/michaelwickson/.hunter/_Base/Download/Hunter/0.19.86/aafb99b
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

[hunter ** INTERNAL **] Build project failed
[hunter ** INTERNAL **] [Directory:/Users/michaelwickson/Applications/ethminer]

------------------------------ WIKI -------------------------------
https://github.com/ruslo/hunter/wiki/error.internal


CMake Error at cmake/HunterGate.cmake:82 (message):
Call Stack (most recent call first):
cmake/HunterGate.cmake:92 (hunter_gate_wiki)
cmake/HunterGate.cmake:346 (hunter_gate_internal_error)
cmake/HunterGate.cmake:510 (hunter_gate_download)
CMakeLists.txt:12 (HunterGate)

-- Configuring incomplete, errors occurred!

Nevermind ... i think i have it now

It's working now but all I get is a bunch of zeroes:

ℹ 16:32:06| Found suitable OpenCL device [ HD Graphics 4000 ] with 1610612736 bytes of GPU memory
ℹ 16:32:06| Connecting to stratum server us2.ethermine.org:4444
ℹ 16:32:06|stratum Connected to stratum server us2.ethermine.org : 4444
ℹ 16:32:06|stratum Starting farm
cl 16:32:06|cl-0 No work. Pause for 3 s.
ℹ 16:32:06|stratum Subscribed to stratum server
ℹ 16:32:06|stratum Authorized worker 0x5ead442ce3bf8089409d6415758def3e34f518e0.mrwickson
ℹ 16:32:06|stratum Received new job #2f790f64
m 16:32:06| Speed 0.00 Mh/s gpu/0 0.00 [A0+0:R0+0:F0] Time: 00:00
m 16:32:06| Speed 0.00 Mh/s gpu/0 0.00 [A0+0:R0+0:F0] Time: 00:00
m 16:32:07| Speed 0.00 Mh/s gpu/0 0.00 [A0+0:R0+0:F0] Time: 00:00
m 16:32:07| Speed 0.00 Mh/s gpu/0 0.00 [A0+0:R0+0:F0] Time: 00:00
m 16:32:07| Speed 0.00 Mh/s gpu/0 0.00 [A0+0:R0+0:F0] Time: 00:00
m 16:32:07| Speed 0.00 Mh/s gpu/0 0.00 [A0+0:R0+0:F0] Time: 00:00

Does my MacBook have too old of a graphics card or is there a lag while a DAG file is downloaded?

Would you show me your result from this command?

./ethminer --list-devices

Same problem .
Screen Shot 2017-12-24 at 12.10.26 AM.png

Your result shows that your graphics device(Redeon Pro 455) has 2GB memory, and I think it's not enough to handle recent DAG file.

Congratulations @soon8013! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

This is a great tutorial. I followed it step by step, finally, started mining. This feeling is very great. Thank you .
result:

m  14:28:29|          Got work package: #bd36410c
m  14:28:30|          Speed   0.00 Mh/s    gpu/0  0.00  [A0+0:R0+0:F0] Time: 00:08

Loading...

Congratulations @soon8013! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemitBoard - Witness Update
SteemFest³ - SteemitBoard support the Travel Reimbursement Fund.

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @soon8013! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 100 comments. Your next target is to reach 200 comments.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Meet the Steemians Contest - Special attendees revealed
Meet the Steemians Contest - Intermediate results

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @soon8013! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 7000 upvotes. Your next target is to reach 8000 upvotes.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Meet the Steemians Contest - The results, the winners and the prizes
Meet the Steemians Contest - Special attendees revealed
Meet the Steemians Contest - Intermediate results

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @soon8013! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!


Congratulations @soon8013!
You raised your level and are now a Dolphin!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!