Installing CGMiner 3.1.0 on Mac OS X 10.8

Updated July 15, 2013:
There are now much better options for running cgminer on a Mac than compiling it yourself. Take a look at Asteroid, an easy-to-use front-end to cgminer and super Mac-friendly. Or if you still like the command line, I’ve also released universal binaries precompiled and ready to run at spaceman.ca/cgminer.

The information below is now out of date.

One of the latest and greatest BitCoin miners out there these days is CGMiner. It is an advanced and adaptive GPU, FPGA and ASIC miner incorporating all the major BitCoin mining kernels out there (diablo, poclbm, phatk and diakgcn) and has key features such as long-polling, multiple pools, etc.

CGMiner in Mac OS X 10.8.3 Terminal

CGMiner in Mac OS X 10.8.3 Terminal

There are a few options to get this running on a Mac. Until recently, your only option was to download the source code and compile it via Terminal, which I’ve detailed below. In the last couple of days, a few additional options have sprung up. Nate Woolls has built a Homebrew installation that is very simple once you have homebrew installed, but isn’t (yet) part of the official homebrew packages yet. And BitBacco is working on a Mac installer package called MacMiner currently in beta, and he’s looking for testers. And if you want to get set up mining now with as little hassle as possible (but at a slower hash rate), check out BitMinter.

Still want to build it yourself from the latest source code? Here’s what you need to do. I promise it’s not too tough.

  1. Install Apple’s XCode
    This is the IDE for programming on the Mac. Don’t worry, we just need some of the tools that it installs, you won’t actually be working in Xcode. Next:
    • Launch XCode
    • Go to “Preferences…” under the “Xcode” menu
    • Click on the “Downloads” page
    • Click the “Install” button beside “Command Line Tools
       
  2. Download cgminer
    Download the latest version with “tar.bz2” as the file suffix (not x86_64). Unzip this file wherever you like, and remember the location for when we compile cgminer later on.
     
  3. Install Homebrew
    Homebrew provides access to lots of little utilities used by command-line apps. We’ll only install the ones we absolutely need for CGMiner.

    If you followed my previous guide and you have MacPorts installed, you can remove MacPorts by following the quick instructions here.
     

  4. Open Terminal
    Enter the following to install the Homebrew packages we’ll need for compiling CGMiner (otherwise known as cgminer’s dependencies):
    • brew doctor
      Checks to see that Homebrew is ready to work and there are no issues. If it returns some warnings, read the text and do what it says to fix it.
    • brew install coreutils autoconf automake jansson libgcrypt libgpg-error libtool libusb pkg-config yasm curl
      Paste all on one line. This downloads, compiles and installs each of the dependencies needed for cgminer in one fell swoop.
  5. Compile and install CGminer
    Enter the following into your terminal, and customize it if you’d like. Each command should be entered on a single line.
    • cd (drag and drop the cgminer folder onto the Terminal window)
    • ./configure --enable-scrypt PKG_CONFIG_PATH=/usr/local/opt/curl/lib/pkgconfig CFLAGS="-g -O2 -Wall"
    • sudo make install
       
  6. Finished! You should now be able to type “cgminer” into your Terminal to run it. For a list of command-line options to include (including attaching to a mining pool), see the original documentation for CGMiner. For example, use cgminer -o http://pool:port -u username -p password with your own values to attach to a pool

Update (2013.04.08): ADL is not supported on the Mac, and is unlikely to be anytime soon in a form that the developers of cgminer would be likely interested in developing for. Therefore, you can live life without ADL (GPU overclocking, temp/fan management, etc) or try downloading a windows version and running it via Boot Camp.

Update (2013.04.09): Changed some formatting in the post for easier copy/paste.

Update (2013.04.25): Switched from MacPorts to Homebrew, and updated guide for cgminer 3.0.1 (previously 2.11.4).

Update (2013.04.29): Updated for cgminer 3.1.0. Added links to other good projects to bring cgminer and bfgminer to mac.

1NjVM9Ua57FTDXr3PfJSVwguhLPmQHAAdQ

Happy mining!

Explore posts in the same categories: BitCoin, Technology

62 Comments on “Installing CGMiner 3.1.0 on Mac OS X 10.8”

  1. Donavon Says:

    I originally installed CGMiner using the instructions were MacPorts was used. I have 3.0.1 running now using those instructions. I wanted to update to the latest (3.1.1 as of now) and followed the new instructions for 3.1.0 which requires the removal of MacPorts.

    After removing MacPorts as requested, installing Homebrew and all that, when I go to compile and run CGMiner I get a curl error. It tells me I have 7.0 but 8.0 is required.

    How should I proceed? I can only assume that MacPorts is involved here.

  2. Kerry Says:

    @Donavon Try using “brew doctor” in the Terminal and see if it returns anything. Assuming it doesn’t report any errors, be sure to run configure with “PKG_CONFIG_PATH=/usr/local/opt/curl/lib/pkgconfig” as noted above and see if that helps!

  3. Kath Says:

    I have a GEForce 320M (mid 2010 13 inch MBP) and can’t get better than 5Mh/s. Any suggestions?

  4. Kade Says:

    Been trying to get Cgminer or BGminer installed on Lion for a week and no luck on either…This is what I get when i try to run CGminer via terminal. Of course the xxxxx are replaced with username and pass. I am pretty sure it did not configure and install correctly as I cannot find any help on getting Lion running. Seems to be all for Mountain Lion out there..

    [2013-05-21 02:14:19] Started cgminer 3.1.0
    [2013-05-21 02:14:19] Started cgminer 3.1.0
    [2013-05-21 02:14:20] Need to specify at least one pool server.
    Input server details.
    URL:
    http://mining.usa.la.hypernova.pw:9332
    Username:
    xxxxxx
    Password:
    xxxxx
    Segmentation fault: 11
    logout

    [Process completed]

    When I try to compile Cgminer 3.1.1. from cgminer-3.1.1 .tar.bz2 this is the complete log from compile to install . Please help!!

    ——-

    Last login: Tue May 21 02:22:15 on ttys000
    Pup-Patrol:~ Kade$ cd /Users/Kade/Downloads/cgminer-3.1.1
    Pup-Patrol:cgminer-3.1.1 Kade$ ./configure –enable-scrypt PKG_CONFIG_PATH=/usr/local/opt/curl/lib/pkgconfig CFLAGS=”-g -O2 -Wall”
    checking build system type… x86_64-apple-darwin11.4.2
    checking host system type… x86_64-apple-darwin11.4.2
    checking target system type… x86_64-apple-darwin11.4.2
    checking for a BSD-compatible install… /usr/local/bin/ginstall -c
    checking whether build environment is sane… yes
    checking for a thread-safe mkdir -p… /usr/local/bin/gmkdir -p
    checking for gawk… no
    checking for mawk… no
    checking for nawk… no
    checking for awk… awk
    checking whether make sets $(MAKE)… yes
    checking whether make supports nested variables… yes
    checking for style of include used by make… GNU
    checking for gcc… gcc
    checking whether the C compiler works… yes
    checking for C compiler default output file name… a.out
    checking for suffix of executables…
    checking whether we are cross compiling… no
    checking for suffix of object files… o
    checking whether we are using the GNU C compiler… yes
    checking whether gcc accepts -g… yes
    checking for gcc option to accept ISO C89… none needed
    checking dependency style of gcc… gcc3
    checking how to run the C preprocessor… gcc -E
    checking for grep that handles long lines and -e… /usr/bin/grep
    checking for egrep… /usr/bin/grep -E
    checking for ANSI C header files… rm: conftest.dSYM: is a directory
    rm: conftest.dSYM: is a directory
    yes
    checking for sys/types.h… yes
    checking for sys/stat.h… yes
    checking for stdlib.h… yes
    checking for string.h… yes
    checking for memory.h… yes
    checking for strings.h… yes
    checking for inttypes.h… yes
    checking for stdint.h… yes
    checking for unistd.h… yes
    checking minix/config.h usability… no
    checking minix/config.h presence… no
    checking for minix/config.h… no
    checking whether it is safe to define __EXTENSIONS__… yes
    checking whether to enable maintainer-specific portions of Makefiles… no
    checking for gcc… (cached) gcc
    checking whether we are using the GNU C compiler… (cached) yes
    checking whether gcc accepts -g… (cached) yes
    checking for gcc option to accept ISO C89… (cached) none needed
    checking dependency style of gcc… (cached) gcc3
    checking for ranlib… ranlib
    checking whether gcc needs -traditional… no
    checking whether gcc and cc understand -c and -o together… yes
    checking for ranlib… (cached) ranlib
    checking sys/mman.h usability… yes
    checking sys/mman.h presence… yes
    checking for sys/mman.h… yes
    checking wchar.h usability… yes
    checking wchar.h presence… yes
    checking for wchar.h… yes
    checking for stdint.h… (cached) yes
    checking for mprotect… yes
    checking for sigaction… yes
    checking for sigaltstack… yes
    checking for siginterrupt… yes
    checking for mmap… yes
    checking for MAP_ANONYMOUS… yes
    checking whether memchr works… yes
    checking whether memmem is declared… yes
    checking for memmem… yes
    checking whether memmem works… no
    checking for C/C++ restrict keyword… __restrict
    checking for uid_t in sys/types.h… yes
    checking for inline… inline
    checking whether the preprocessor supports include_next… yes
    checking whether system header files limit the line length… no
    checking for wchar_t… yes
    checking for unsigned long long int… yes
    checking for long long int… yes
    checking whether stdint.h conforms to C99… no
    checking sys/inttypes.h usability… no
    checking sys/inttypes.h presence… no
    checking for sys/inttypes.h… no
    checking sys/bitypes.h usability… no
    checking sys/bitypes.h presence… no
    checking for sys/bitypes.h… no
    checking for bit size of ptrdiff_t… 64
    checking for bit size of size_t… 64
    checking for bit size of sig_atomic_t… 32
    checking for bit size of wchar_t… 32
    checking for bit size of wint_t… 32
    checking whether sig_atomic_t is signed… yes
    checking whether wchar_t is signed… yes
    checking whether wint_t is signed… yes
    checking for ptrdiff_t integer literal suffix… l
    checking for size_t integer literal suffix… ul
    checking for sig_atomic_t integer literal suffix…
    checking for wchar_t integer literal suffix…
    checking for wint_t integer literal suffix…
    checking whether memmem is declared without a macro… yes
    checking whether mempcpy is declared without a macro… no
    checking whether memrchr is declared without a macro… no
    checking whether rawmemchr is declared without a macro… no
    checking whether stpcpy is declared without a macro… yes
    checking whether stpncpy is declared without a macro… yes
    checking whether strchrnul is declared without a macro… no
    checking whether strdup is declared without a macro… yes
    checking whether strncat is declared without a macro… yes
    checking whether strndup is declared without a macro… yes
    checking whether strnlen is declared without a macro… yes
    checking whether strpbrk is declared without a macro… yes
    checking whether strsep is declared without a macro… yes
    checking whether strcasestr is declared without a macro… yes
    checking whether strtok_r is declared without a macro… yes
    checking whether strerror_r is declared without a macro… yes
    checking whether strsignal is declared without a macro… yes
    checking whether strverscmp is declared without a macro… no
    checking for memmem… (cached) yes
    checking whether memmem works… (cached) no
    checking for struct sigaction.sa_sigaction… yes
    checking for volatile sig_atomic_t… yes
    checking for sighandler_t… no
    checking whether sigaction is declared without a macro… yes
    checking whether sigaddset is declared without a macro… yes
    checking whether sigdelset is declared without a macro… yes
    checking whether sigemptyset is declared without a macro… yes
    checking whether sigfillset is declared without a macro… yes
    checking whether sigismember is declared without a macro… yes
    checking whether sigpending is declared without a macro… yes
    checking whether sigprocmask is declared without a macro… yes
    checking for sigprocmask… yes
    checking whether NULL can be used in arbitrary expressions… yes
    checking for ANSI C header files… (cached) yes
    checking syslog.h usability… yes
    checking syslog.h presence… yes
    checking for syslog.h… yes
    checking for size_t… yes
    checking for working alloca.h… yes
    checking for alloca… yes
    checking for OpenCL… yes
    checking for pthread_create in -lpthread… yes
    checking for json_loads in -ljansson… yes
    checking for ./ADL_SDK/adl_sdk.h… no
    checking for library containing addstr… -lncurses
    checking for pkg-config… /usr/local/bin/pkg-config
    checking pkg-config is at least version 0.9.0… yes
    checking for LIBCURL… yes
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating compat/Makefile
    config.status: creating compat/jansson/Makefile
    config.status: creating ccan/Makefile
    config.status: creating lib/Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands

    ————————————————————————
    cgminer 3.1.1
    ————————————————————————

    Configuration Options Summary:

    curses.TUI………..: FOUND: -lncurses
    OpenCL……………: FOUND. GPU mining support enabled
    scrypt……………: Enabled
    ADL………………: SDK NOT found, GPU monitoring support DISABLED

    Avalon.ASICs………: Disabled
    BFL.ASICs…………: Disabled
    BitForce.FPGAs…….: Disabled
    Icarus.FPGAs………: Disabled
    ModMiner.FPGAs…….: Disabled
    Ztex.FPGAs………..: Disabled

    Compilation…………: make (or gmake)
    CPPFLAGS………….:
    CFLAGS……………: -g -O2 -Wall
    LDFLAGS…………..:
    LDADD…………….: -L/usr/local/Cellar/curl/7.30.0/lib -lcurl -ljansson -lpthread -framework OpenCL -lm

    Installation………..: make install (as root if needed, with ‘su’ or ‘sudo’)
    prefix……………: /usr/local

    Pup-Patrol:cgminer-3.1.1 Kade$ sudo make install
    Password:
    Making install in lib
    GEN signal.h
    GEN stdint.h
    GEN string.h
    make install-recursive
    CC memmem.o
    AR libgnu.a
    /usr/bin/ranlib: file: libgnu.a(dummy.o) has no symbols
    ranlib: file: libgnu.a(dummy.o) has no symbols
    make[4]: Nothing to be done for `install-exec-am’.
    make[4]: Nothing to be done for `install-data-am’.
    Making install in compat
    make[3]: Nothing to be done for `install-exec-am’.
    make[3]: Nothing to be done for `install-data-am’.
    Making install in ccan
    make[2]: Nothing to be done for `install-exec-am’.
    make[2]: Nothing to be done for `install-data-am’.
    CC cgminer-cgminer.o
    CC cgminer-util.o
    util.c: In function ‘keep_sockalive’:
    util.c:207: warning: unused variable ‘tcp_keepidle’
    util.c: In function ‘__stratum_send’:
    util.c:970: error: ‘MSG_NOSIGNAL’ undeclared (first use in this function)
    util.c:970: error: (Each undeclared identifier is reported only once
    util.c:970: error: for each function it appears in.)
    make[1]: *** [cgminer-util.o] Error 1
    make: *** [install-recursive] Error 1
    Pup-Patrol:cgminer-3.1.1 Kade$

  5. Kade Says:

    any idea what Segmentation Fault 11 means which running Cgminer?

  6. Lacedaemon Says:

    @Kade:

    Did you actually get CGMiner to make/compile? I’m getting the same error as you when make-ing CGMiner, but I’m on OS X Mountain Lion 10.8.3.

    Any ideas?

  7. Rich Says:

    Hello,

    I followed your instructions and everything seemed to install OK. When I run “cgminer” I do not get any text to indicate its working (my terminal window flashes and thats it).

    Where can I see logging to show why the screen flashes (for a split second) and then disappears?

    Below is the last logging I saw during installation. I did want to attempt to use my video card (and logging seems to indicate OpenCL support enabled. Any thoughts?

    ————————————————————————
    cgminer 3.2.0
    ————————————————————————

    Configuration Options Summary:

    curses.TUI………..: FOUND: -lncurses
    OpenCL……………: FOUND. GPU mining support enabled
    scrypt……………: Enabled
    ADL………………: SDK NOT found, GPU monitoring support DISABLED

    Avalon.ASICs………: Disabled
    BFL.ASICs…………: Disabled
    BitForce.FPGAs…….: Disabled
    Icarus.FPGAs………: Disabled
    ModMiner.FPGAs…….: Disabled
    Ztex.FPGAs………..: Disabled

    Compilation…………: make (or gmake)
    CPPFLAGS………….:
    CFLAGS……………: -g -O2 -Wall
    LDFLAGS…………..:
    LDADD…………….: -L/usr/local/Cellar/curl/7.30.0/lib -lcurl -ljansson -lpthread -framework OpenCL -lm

    Installation………..: make install (as root if needed, with ‘su’ or ‘sudo’)
    prefix……………: /usr/local

  8. rajat Says:

    @Kade and @Lacedaemon,
    I put in a ghetto hack for MSG_NOSIGNAL that allowed me to compile and provisionally make some progress.

    MSG_NOSIGNAL is a socket or tcp related definition that exists on linux and not mac osx:
    http://lists.apple.com/archives/macnetworkprog/2002/Dec/msg00091.html

    I added this line to util.c after the include statements:
    #define MSG_NOSIGNAL 0x2000

    I know it isn’t the correct command, but it’s my best guess and it doesn’t totally destroy the TCP communications. My cgminer is working fine and posting results to litebonk.

  9. rye Says:

    Figured out how to do this – one thing I can’t figure out how to do is to disable the GPU mining. I’m using it with a Block Erupter, but don’t want the GPU to be mining. is this possible?

  10. Kerry Says:

    @Rye – Yes, just add “–disable-gpu” to your command line when you launch cgminer.

  11. rye Says:

    that oddly shut off my amu

  12. Sebas Says:

    So I was able to install it. After entering my username and pwd i get this. Any recommendations????
    Thx!

    [2013-07-17 22:29:15] Probing for an alive pool
    [2013-07-17 22:29:27] Error -2: Creating Command Queue. (clCreateCommandQueue)
    [2013-07-17 22:29:27] Failed to init GPU thread 2, disabling device 1
    [2013-07-17 22:29:27] Restarting the GPU from the menu will not fix this.
    [2013-07-17 22:29:27] Try restarting cgminer.
    [2013-07-17 22:31:24] Error -2: Creating Command Queue. (clCreateCommandQueue)
    [2013-07-17 22:31:24] Failed to init GPU thread 3, disabling device 1
    [2013-07-17 22:31:24] Disabling extra threads due to dynamic mode.
    [2013-07-17 22:31:24] Tune dynamic intensity with –gpu-dyninterval
    [2013-07-17 22:31:25] Network diff set to 26.2M
    [2013-07-17 22:31:25] Error -54: Enqueueing kernel onto command queue. (clEnqueueNDRangeKernel)
    [2013-07-17 22:31:25] GPU 0 failure, disabling!
    [2013-07-17 22:31:25] Thread 1 being disabled
    [2013-07-17 22:31:25] Error -54: Enqueueing kernel onto command queue. (clEnqueueNDRangeKernel)
    [2013-07-17 22:31:25] GPU 0 failure, disabling!
    [2013-07-17 22:31:25] Thread 0 being disabled

Comment: