Can a P1 be setup to connect to the internet without claiming it?

Is CLI 1.29 released? I think CLI Version 1.25.0 is the latest available for OSX that I can seem to download using:
npm update -g particle-cli

I’ll post a simplified version of my setup here when I’ve got it working well. Looks like I’ll use a combination of Bash and Expect.

Do a

which particle

If it comes back as /Users/YOUR_USERNAME/bin/particle you have the CLI installed with the Particle CLI installer for Mac or Linux and you should instead upgrade it using:

particle update-cli

The npm update is probably updating the wrong one, which is why the version isn’t changing.

In general, the best thing to do on the Mac now is to uninstall the npm -g one:

sudo npm uninstall -g particle-cli

and then use the Particle CLI installer. If you try to use the -g version on High Sierra it will eventually stop working with unfixable permission errors (unless you installed all of node as your own username not using sudo).

bash <( curl -sL )

Got my setup fixed @rickkas7. I had two installs and confused paths with permission errors. Found a better way to set the global npm folder.

Here’s the new device Setup script that I’ve come up with. It’s based on Shell and it’s been rock solid. It only takes 30 seconds per device, so I think I’ll head into my office tonight and claim those 60 devices :smiley:

Here’s what the script currently does:

  1. Query the computer (OSX or UNIX) for the relevant USB port
  2. Set the device to listening mode (if required)
  3. Query the device for the deviceID
  4. Set the Wifi Credentials using credentials stored in text file
  5. Claim the device (make sure you’re logged in with the correct user!)
  6. Set the device DFU mode, so we can upload firmware
  7. Flash our device test & setup firmware via Serial

I’ll also add some Project specific calls using curl to it also that will simplify the process even further for me, but this should be a good start for others needing something similar.


I’ve always used:

sudo npm install -g --unsafe-perm particle-cli

Without having any issues.

Nice script, but stty works differently on Linux than it does on Mac. I’ll probably be forking this to make some improvements.

1 Like

Would be great if we could make it work on both platforms!

Originally we tried sudo npm install -g --unsafe-perm particle-cli as it works great under Linux, and it helped on the Mac. However, under High Sierra it didn’t always solve the problem. That’s why we switched to a non-root node.js and particle-cli.

1 Like


Here is my version of the script:

When it briefly didn’t solve the problem for me I was able to fix it with:

sudo npm uninstall -g --unsafe-perm particle-cli
sudo npm install -g --unsafe-perm particle-cli

Great improvements and quite a lot of them too! Much more flexible than my first version :smiley:

Hi @jenschr,

Sorry I didn’t see notifications.

My approach was adding the JSON file option to the Particle serial wifi command and it was eventually accepted by the Particle team. Squeaky wheel works!

It seems your script does pretty much what do. For interests sake I’ll take some quick notes on mine:

  • List out the ports, find the particle or spark devices manufacturer
  • Get the device ID
  • put in DFU
  • set the SSID prefix
  • update the software via flashing manually with dfu-util the relevant part1 & part2. So so so much faster than using particle update commands
  • find the port number again (yes, it changes often after changing base firmware)
  • run the serial wifi with the relevant JSON file of wifi creds
  • claim the device (my products belong to me in terms of claiming)
  • rename the device with a prefix, dateformat, and 3 random short words (makes it so much easier to spot , ie sdb-180124-wiry-cue-ghost [3b0052001851353530333xxx] (P1) is offline
  • flash software .bin file to device using standard particle flash, i don’t do this via DFU and --usb because strangely it was unreliable, can’t remember exactly why
  • run diagnostics via calling functions on the new device to check its reading the universe correctly and the PCB is working


1 Like