Tutorial: Particle-cli on Mac OSX [26 Sep 2015]

You can grab the binary here: http://dfu-util.sourceforge.net/releases/

@kennethlimcp Thanks for responding. I didnā€™t mention that Iā€™m using macOS, but I guess you inferred that from my mentioning homebrew.

I had already installed the Particle CLI using the advanced method. The install and login were successful. I then downloaded the dfu-util from the mirror link in that section of the guide. I extracted the contents using gzip and tar and then moved the contents of the linux-i386 folder (the three binaries) to a folder in my path (my npm global bin folder).

When I tried to use $ particle flash --usb tinker command, I got the following error: Error writing firmwareā€¦dfu-util is not installed. Did I miss something? Are there macOS-specific binaries somewhere? Is particle-cli hard-coded to look for the binaries in a specific folder?

Yes basically cli is looking at a globally accessible path to search for dfu-util.,

You can either have it in a common path known by terminal or modify your PATH variable accordingly. :slight_smile:

@kennethlimcp Thatā€™s what I did and then I got that error message.

@KyleG Any idea?

what do you get when you run dfu-util on the terminal?

1 Like

@kennethlimcp Sorry about the delay. I get the following error:

cannot execute binary file

Some research informed me that the likely cause is that the binary is not the right architecture for my processor (64-bit). Is there a precompiled dfu-util binary for macOS that works on 64-bit Macs?

npm is installed on my computer, but I am not willing to install Homebrew or MacPorts (or other package management softwares) because of their required permissions.

Probably can compile using the files here: https://downloads.sourceforge.net/project/dfu-util/dfu-util-0.9.tar.gz

@kennethlimcp Iā€™ve never complied anything but Iā€™ll take a stab at it. Researching gcc, clang, make etc. now.

This might also work:

git clone git://git.code.sf.net/p/dfu-util/dfu-util
cd dfu-util
./autogen.sh
./configure
make
sudo make install

Iā€™m going to stop pursuing this at this point since thereā€™s no prebuilt dfu-util binary for x64 Mac machines. It would be nice for Particle to build all of the necessary cli binaries for popular platforms.

@nrobinson2000 Thanks for the input. autoreconf is not included with macOS, so the autogen script fails.

Whoops, my bad. Those were Linux instructions.

EDIT: They work on my mac too.

I just tried this on my mac and produced a binary successfully:

curl -LO https://downloads.sourceforge.net/project/dfu-util/dfu-util-0.9.tar.gz
open dfu-util-0.9.tar.gz
cd dfu-util-0.9/
./autogen.sh
./configure
make

The binary is produced in src

You may be missing Command line developer tools, which includes things like git, make, gcc, etc:

Try doing:

xcode-select --install

Here is the dfu-util binary I just built if you want it. Just click on the download button. (You will need to make it executable with chmod +x dfu-util)

@nrobinson2000 Thanks, againā€”especially for building the binary. In response to the rest of your post:

Xcode command line tools donā€™t seem to include autoconf. I already had them installed, but the binary is not present:

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ which autoconf
$ 

Might you have installed Homebrew? I know it includes more build tools than are provided by Xcode.

I do have Homebrew installed on my mac. It's kind of essential these days if you're going to do any compiling or development.

rm -r ~/.node-gyp

This worked for me.

1 Like