MadMax Plotter on macOS: Create Chia™ Plots on Intel/M1 Macs

Chia cryptocurrency’s growing popularity has attracted the attention of many developers, who are investing more and more effort into improving the software, while also developing various software solutions.

One of these solutions is “madMAx43v3r“, which has extensive experience in the development of various mining software (in particular on GPU). Unfortunately, the official documentation lacks information on how to build “chia-plotter” on macOS. Our team worked to solve this issue and succesfully closed that gap, and now we are able to provide you a series of steps you will need to follow on macOS, in order to build “chia-plotter” from the source code.

We have already builded version for MacOS in our Telegram and Discord. If you don’t want to bother you can just download it.

In fact, the speed of plotting depends on many parameters: what disks you use (SATA/NVMExpress HDD/SSD, USB 2.0/3.1 HDD/SSD, USB-C HDD/SSD or Thunderbolt 3 NVMExpress, etc), what year you have a Mac (for example Intel i5 based Mac mini mid 2011 or Intel i9 based MacBook Pro 16″ 2019) and how many threads it has (4..16), how much RAM (4..128 GB), etc.

System requirements:
  • Intel or M1 based Mac;
  • macOS Catalina (10.15.x) or macOS Big Sur (11.x);
  • Xcode 12.x.

    Quick Tips:
  • On unsupported Macs, you can use the “dosdude1’s” patcher to install Catalina (for example on Mac mini mid 2011)
  • Please note that about 1 GB of RAM will be used per thread (with 128 buckets). Thus, with default settings (4 threads and 128 buckets) about 4 GB of RAM will be used. Reducing the number of buckets leads to an increase in the used RAM – with 64 buckets 2 GB of memory will be used per thread (for example with 4 threads and 64 buckets, 8 GB of RAM will be used). Increasing the number of buckets lead to a decrease in the used RAM – with 256 buckets 0.5 GB of RAM will be used per thread (for example with 4 threads and 256 buckets, 2 GB of RAM will be used).
  • Please note that the operating system also requires RAM. If there is no free RAM left, the hard disk (or system SSD) will be used (the swap file will be used) which will lead to a significant drop in speed. You can also use utilities to free up RAM on your Mac (for example SmartMemoryCleaner).

What do you need to do is to install a package manager called Brew on your macOS and Xcode or Xcode Command Line Tool from the Apple App Store.

Before you start run next Terminal commands:

brew update
brew upgrade

After that just apply all of the following commands in the Terminal application:

This will install Xcode Command Line Tool:

xcode-select --install
brew install libsodium cmake git autoconf automake libtool wget
brew uninstall gmp
brew link cmake

If you downloaded Xcode run these:

sudo ln -s /usr/local/include/sodium.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
sudo ln -s /usr/local/include/sodium /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/

If you downloaded Xcode Command Line Tool:

sudo ln -s /usr/local/include/sodium.h /Library/Developer/CommandLineTools/usr/include
sudo ln -s /usr/local/include/sodium /Library/Developer/CommandLineTools/usr/include

Confirm which directory you have on YOUR Mac before applying following commands!

For Intel based Macs:

wget https://raw.githubusercontent.com/facebookincubator/fizz/master/build/fbcode_builder/CMake/FindSodium.cmake -O /usr/local/opt/cmake/share/cmake/Modules/FindSodium.cmake

For M1 based Macs:

Please note that instead of the “*” you need to specify the CMake version that is installed on your Mac, for example “3.20.5”.

cmake --version

Place number you get instead of * below:

wget 
https://raw.githubusercontent.com/facebookincubator/fizz/master/build/fbcode_builder/CMake/FindSodium.cmake -O /opt/homebrew/Cellar/cmake/*/share/cmake/Modules/FindSodium.cmake

Now we can build chia-plotter:

git clone https://github.com/madMAx43v3r/chia-plotter.git
cd chia-plotter
git submodule update --init
./make_devel.sh

Now all you need to do is to wait for the app to build successfully…

Lastly run the command below, in the Terminal application in order to familiarize yourself with all the possible parameters that can be set:

./build/chia_plot --help

If a maximum open file limit error occurs (as default OS setting is 256, which is too low for default bucket size of 256), run this before starting the plotter (this file limit change will only affect the current session):

ulimit -n 3000

What should I do if I get errors

If at any of the steps you get an error, you can delete the build folder from the chia-plotter folder manually or in the Terminal application:

rm -rf build

Or use the clean_all.sh script:

./clean_all.sh

After that, try to build chia-plotter again starting with the command ./make_devel.sh command in this tutorial.

If trying to build chia-plotter again fails, you can delete the entire chia-plotter folder and start over from the first steps in this tutorial.

If you are discouraged and want someone to help you – you can contact us on Telegram, Discord or Twitter.

How to create PlotNFT Plots with MadMax

In order to create a PlotNFT Plot you need to get the farmer’s key and the address of the PlotNFT. If you haven’t created a PlotNFT yet, you can find out how to create one in this article How to connect to (Chia) XCH Cloud Pool

After PlotNFT is created, you can run the following command in the Terminal application and copy P2 singleton address (pool contract address for plotting):

/Applications/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia plotnft show

After that, you can run the following command in the Terminal application and copy Farmer public key:

/Applications/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia keys show

Now you can run chia-plotter with the parameters you want to create the PlotNFT plot.

As an example, we create 1 plot using 4 processor threads and 256 buckets (default).

In this case, the first disk we have is the Disk1 (disk name in Finder) disk on which the Plots folder is created – needs about 220 GiB space, it will handle about 25% of all writes.

The second drive we have is the Disk2 drive on which the Plots folder is created – needs about 110 GiB space and ideally is a RAM drive, it will handle about 75% of all writes.

The drive to which the plot will be saved is the Disk3 drive on which the Plots folder is created.

Please note that instead of xch10000000000 you must insert your P2 singleton address (pool contract address for plotting), and instead of 1234567890 you must insert your Farmer public key.

./build/chia_plot -n 1 -r 4 -u 256 -t /Volumes/Disk1/Plots/ -2 /Volumes/Disk2/Plots/ -d /Volumes/Disk3/Chia/ -c xch10000000000 -f 1234567890

Parameters for plotting command

Here’s a list of all parameters for plotting command. You can also type –help to view it in terminal.

ParameterDescription
-n, –count argNumber of plots to create (default = 1, -1 = infinite)
-r, –threads argNumber of plots to create (default = 1, -1 = infinite)
-u, –buckets argNumber of buckets (default = 256)
-v, –buckets3 argNumber of buckets for phase 3+4 (default = buckets)
-t, –tmpdir argTemporary directory, needs ~220 GiB (default = $PWD)
-2, –tmpdir2 argTemporary directory 2, needs ~110 GiB [RAM] (default = <tmpdir>)
-d, –finaldir argFinal directory (default = <tmpdir>)
-w, –waitforcopyWait for copy to start next plot
-p, –poolkey argPool Public Key (48 bytes)
-c, –contract argPool Contract Address (62 chars)
-f, –farmerkey argFarmer Public Key (48 bytes)
-G, –tmptoggleAlternate tmpdir/tmpdir2 (default = false)

Afterword

The developer has provided a key information about the portability of the build on other Macs that you might use for plotting “The binaries will end up in build /, you can copy them elsewhere freely (on the same machine, or similar OS).

You can find more informations on the project’s page GitHub.

If you have any issues running plotter on macOS you can contact us on Telegram, Discord or Twitter.

Join our XCH Cloud Pool and get stable service and great support team!

Best regards,
yours XCH CLOUD POOL TEAM

38 Comments

  1. Get always these error

    -- Build files have been written to: /Users/Kaspersky/chia-plotter/build
    Consolidate compiler generated dependencies of target fse
    Scanning dependencies of target blake3
    Consolidate compiler generated dependencies of target blstmp
    Consolidate compiler generated dependencies of target blake3
    [ 0%] Built target arith_objs
    [ 0%] Building ASM object CMakeFiles/blake3.dir/lib/BLAKE3/c/blake3_avx2_x86-64_unix.S.o
    [ 2%] Built target fse
    [ 2%] Building ASM object CMakeFiles/blake3.dir/lib/BLAKE3/c/blake3_avx512_x86-64_unix.S.o
    [ 2%] Building ASM object CMakeFiles/blake3.dir/lib/BLAKE3/c/blake3_sse2_x86-64_unix.S.o
    [ 3%] Building ASM object CMakeFiles/blake3.dir/lib/BLAKE3/c/blake3_sse41_x86-64_unix.S.o
    [ 5%] Built target blstmp
    Consolidate compiler generated dependencies of target relic_s
    /Users/Kaspersky/chia-plotter/lib/BLAKE3/c/blake3_avx2_x86-64_unix.S:15:1: error: unknown directive
    .intel_syntax noprefix
    ^
    /Users/Kaspersky/chia-plotter/lib/BLAKE3/c/blake3_sse41_x86-64_unix.S:15:1: /Users/Kaspersky/chia-plotter/lib/BLAKE3/c/blake3_avx512_x86-64_unix.S:15:1: error: unknown directive
    .intel_syntax noprefix
    ^
    error: unknown directive
    .intel_syntax noprefix
    ^
    /Users/Kaspersky/chia-plotter/lib/BLAKE3/c/blake3_avx512_x86-64_unix.S:32:9: error: /Users/Kaspersky/chia-plotter/lib/BLAKE3/c/blake3_avx2_x86-64_unix.S:27:9: /Users/Kaspersky/chia-plotter/lib/BLAKE3/c/blake3_sse41_x86-64_unix.S:31:9: unrecognized instruction mnemonic, did you mean: ushl, ushr?
    push r15

          • Definitely yes, but I really have no idea when.
            Most likely some libraries haven’t been ported to M1 yet and it mostly depends on Brew when they will port it.

          • The above is correct, I was able to build on an i7 and then copy over to an M1. Rosetta penalty is about 1.58 times plotting time increase.

            My i7 can do a plot in 4064sec
            The M1 using rosetta, 6441sec

            Granted 6441 is way better than 16560 – 20808 sec on a single plot. Even in rosetta you can now get around 3 plots in the time just 1 single plot using default plotter.

            I expect the plot time to drop on native M1 to 3251 sec.

            On a side not I have found a loose correlation between passmark scoring and the amount of plot a CPU can give you using this plotter. Basically percentage differences between passmark scores can translate to how many plots in 24 hours one can get as long as you have reference score/plot time to start with.

            I had the 8400, 2x2620v2, 8700B and the M1. A bit of rounded number, percentages and a little fuzzy math and the plot count is accurate +2- in either direction (build ram and default setting variations along with the PC being used in other tasks can affect this,

  2. Thank you for this tutorial! Running on Macbook Pro 2018 with Big Sur.
    Unfortunately I get the following error when executing the make_devel.sh command:


    Consolidate compiler generated dependencies of target bls
    [100%] Built target bls
    Consolidate compiler generated dependencies of target chia_plot
    [100%] Linking CXX executable chia_plot
    clang: warning: argument unused during compilation: ‘-fmax-errors=1’ [-Wunused-command-line-argument]
    ld: library not found for -lsodium
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [chia_plot] Error 1
    make[1]: *** [CMakeFiles/chia_plot.dir/all] Error 2
    make: *** [all] Error 2

    Are you able to help?

    • First, make sure you have installed libsodium:
      brew install libsodium

      Second, try to reinstall libsodium:
      brew reinstall libsodium

      Third, check if you have created symlinks by manual (for sodium.h file as well as sodium library folder in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/) or create it with following commands:
      sudo ln -s /usr/local/include/sodium.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
      sudo ln -s /usr/local/include/sodium /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/

      Remove ‘build’ folder and try build project again.

      Also, if it is convenient for you, join us on Discord or Telegram for more support.

  3. Any idea what the minimum RAM requirement is in order to make a big difference in plotting speed? My Mac is only 8GB.

    • This plotter makes optimal use of RAM, so (as you may have noticed) you do not specify its amount on the command line (unlike a standard Chia™ plotter).

      RAM usage depends on threads and buckets. With the default of 128 buckets it’s about 1 GB per thread at most. By default MadMax Plotter used 4 threads and 128 buckets.

      There is a commit in the MadMax repository that allows you to create 256 buckets and reduce the amount of RAM to 0.5 GB per thread. But we haven’t tested this commit on macOS yet.

    • So, if your Mac has 4 threads, you can run the plotter with standard settings and it will take about 4 GB of RAM.

      But if you want to run this plotter with 8 threads (128 buckets) or 4 threads (64 buckets) – you need all 8 GB of RAM. This is not recommended as the operating system also needs some amount of RAM. In this case, you can experiment with a new commit and 256 buckets – then with 8 threads, the application will only use 4 GB of RAM.

      • Can we go for 64 buckets? My CPU is an 18 core and @128 buckets, as I understand, the RAM cost would be 18GB of RAM. But I have more RAM available so can I go 64 buckets or even lower? Would it make a difference?

        • Yes, you can try 64 buckets or less. The main thing is that your computer has enough RAM. Do not forget that the system needs a part and you need to prevent the system from starting to use the swap file.

          The fewer buckets you use, the more processing is done in RAM. It can be faster than working with data on an SSD. It also reduces the number of writes to the disk, which will extend its lifespan (TBWs are limited for each SSD disk).

          • Gotcha! I just finished a plot on 18 cores, 256 buckets in 53 minutes! Will try now same settings but 64 buckets to see if it’s speedier and then with 32 buckets. Have only 96GB of total ram …

    • You can build MadMax on an Intel based Mac, or you can ask someone to do it and just transfer this build to an M1 based Mac. Strangely, the build using Rosetta2 is faster than using the build built on M1. 🤔

  4. Hi, I get this error “chia_plot: command not found” even though chia_plotter is in this folder .. what could be the problem?

      • when i compiled madmax i got some errors: [ 96%] Building C object _deps/relic-build/src/CMakeFiles/relic_s.dir/low/easy/relic_fb_trc_low.c.o
        [ 96%] Linking C static library ../lib/librelic_s.a
        [ 97%] Linking CXX executable test_disk_sort
        clang: warning: argument unused during compilation: ‘-fmax-errors=1’ [-Wunused-command-line-argument]
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/librelic_s.a(relic_dv_mem.c.o) has no symbols
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/librelic_s.a(relic_dv_mem.c.o) has no symbols
        [ 97%] Built target test_disk_sort
        [ 97%] Built target relic_s
        ar: creating archive /Users/liowa/chia-plotter/build/libbls.a
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/liowa/chia-plotter/build/libbls.a(mp_clz_tab.o) has no symbols
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/liowa/chia-plotter/build/libbls.a(obprintf.o) has no symbols
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/liowa/chia-plotter/build/libbls.a(obprntffuns.o) has no symbols
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/liowa/chia-plotter/build/libbls.a(obvprintf.o) has no symbols
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/liowa/chia-plotter/build/libbls.a(repl-vsnprintf.o) has no symbols
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/liowa/chia-plotter/build/libbls.a(relic_dv_mem.c.o) has no symbols
        [ 97%] Built target combined_custom
        [ 98%] Building CXX object lib/bls-signatures/src/CMakeFiles/bls.dir/privatekey.cpp.o
        clang: warning: argument unused during compilation: ‘-fmax-errors=1’ [-Wunused-command-line-argument]
        [ 98%] Linking CXX static library libbls.a
        [ 98%] Built target bls
        [ 98%] Building CXX object CMakeFiles/chia_plot.dir/src/chia_plot.cpp.o
        clang: warning: argument unused during compilation: ‘-fmax-errors=1’ [-Wunused-command-line-argument]
        [ 99%] Linking CXX executable test_phase_4
        clang: warning: argument unused during compilation: ‘-fmax-errors=1’ [-Wunused-command-line-argument]
        [ 99%] Built target test_phase_4
        [ 99%] Linking CXX executable test_phase_2
        clang: warning: argument unused during compilation: ‘-fmax-errors=1’ [-Wunused-command-line-argument]
        [ 99%] Built target test_phase_2
        [100%] Linking CXX executable test_phase_3
        clang: warning: argument unused during compilation: ‘-fmax-errors=1’ [-Wunused-command-line-argument]
        [100%] Built target test_phase_3
        [100%] Linking CXX executable test_phase_1
        clang: warning: argument unused during compilation: ‘-fmax-errors=1’ [-Wunused-command-line-argument]
        [100%] Built target test_phase_1
        [100%] Linking CXX executable chia_plot
        clang: warning: argument unused during compilation: ‘-fmax-errors=1’ [-Wunused-command-line-argument]
        [100%] Built target chia_plot
        liowa@iMac chia-plotter %

  5. Under the M1 section:
    “Please note that instead of the “*” you need to specify the version that is installed on your Mac, for example “3.20.5”.”

    What version is this referring to? Where can I get that? Sorry for the dumb question.

    • You can go to the “/opt/homebrew/Cellar/cmake/” folder in Finder (using the keyboard shortcut Command + Shift + G and paste this path) and see which version you have. Or just try with version 3.20.5 (replace * with 3.20.5) maybe you have it. If you get an error, then you definitely need to go to the folder and take the version number that you have installed.

  6. I get always the following error when executing the make_devel.sh command:

    CMake Error at CMakeLists.txt:25 (find_package):
    By not providing “Findsodium.cmake” in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by “sodium”, but
    CMake did not find one.

    Could not find a package configuration file provided by “sodium” with any
    of the following names:

    sodiumConfig.cmake
    sodium-config.cmake

    Add the installation prefix of “sodium” to CMAKE_PREFIX_PATH or set
    “sodium_DIR” to a directory containing one of the above files. If “sodium”
    provides a separate development package or SDK, be sure it has been
    installed.

    — Configuring incomplete, errors occurred!
    See also “/Users/yilmazakgunes/chia-plotter/build/CMakeFiles/CMakeOutput.log”.
    See also “/Users/yilmazakgunes/chia-plotter/build/CMakeFiles/CMakeError.log”.
    make: *** No targets specified and no makefile found. Stop.

    • Perhaps you have a different path to the Sodium library (especially for M1).

      It may be easier for you to build it for Intel than to build it for M1. Also, the version built for Intel runs faster on the M1 than the one built on the M1. 😅

      If you still cannot build it on Intel, we have a portable MadMax plotter build. You can write to us on Telegram or Discord and we will provide you with it.

  7. So what’s the current best plot time on an M1? I’ve got mine routinely doing 78 mins per plot now. (Compiled for Intel and running under Rosetta 2 with a 1TB TB3 ssd)

  8. Hi I get through all the steps but when I get to build I keep getting this error “Failed to write to tmpdir directory: ‘/Volumes/PortableSSD/’ – any ideas … I know it’s probably something stupid…thanks

    • If your drive or folder has spaces in the name, you need to escape them. For example the disk has the name “Portable SSD” then in the terminal you need to specify “/Volumes/Portable\ SSD/”.

Leave a Reply