# Particle-cli - Mac

**URL:** <https://community.particle.io/t/particle-cli-mac/34398>\
**Category:** Troubleshooting\
**Created:** [July 8, 2017, 9:01am UTC](https://community.particle.io/t/particle-cli-mac/34398 "2017-07-08T09:01:07Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ParticleIce](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@ParticleIce](https://community.particle.io/u/ParticleIce)\
**Post date:** [July 8, 2017, 9:01am UTC](https://community.particle.io/t/particle-cli-mac/34398/1 "2017-07-08T09:01:08Z")

</div>

I was making MARS Rover. Spending time messing round. Making Reboot.  
Uninstall Particle-Cli and install the latest Node JS

```
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/inquirer/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/particle-api-js/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/request/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/string-width/node_modules
npm WARN checkPermissions Missing write access to /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/wrap-ansi/node_modules
npm ERR! path /Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/xxxxx/.npm-packages/lib/node_modules/particle-cli/node_modules/commander' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xxxxx/.npm/_logs/2017-07-08T08_49_07_031Z-debug.log

npm WARN excluding symbolic link test/server/static/ie8-polyfill.js -> ../../../ie8-polyfill.js
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN excluding symbolic link test/server/static/ie8-polyfill.js -> ../../../ie8-polyfill.js

```

and sudo npm install -g particle-cli

$ particle  
-bash: particle: command not found

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [July 8, 2017, 9:22am UTC](https://community.particle.io/t/particle-cli-mac/34398/2 "2017-07-08T09:22:29Z")

</div>

What OS are you running on?

---

<div class="post-metadata">

**Author:** ![ParticleIce](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@ParticleIce](https://community.particle.io/u/ParticleIce)\
**Post date:** [July 8, 2017, 9:24am UTC](https://community.particle.io/t/particle-cli-mac/34398/3 "2017-07-08T09:24:06Z")

</div>

macOS Sierra 10.12.5.

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [July 8, 2017, 9:25am UTC](https://community.particle.io/t/particle-cli-mac/34398/4 "2017-07-08T09:25:32Z")

</div>

You might need to follow this tutorial to fix the npm issue: [https://docs.npmjs.com/getting-started/fixing-npm-permissions](https://docs.npmjs.com/getting-started/fixing-npm-permissions)

---

<div class="post-metadata">

**Author:** ![nrobinson2000](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/nrobinson2000/32/15624_2.png) [@nrobinson2000](https://community.particle.io/u/nrobinson2000)\
**Post date:** [July 8, 2017, 2:41pm UTC](https://community.particle.io/t/particle-cli-mac/34398/5 "2017-07-08T14:41:59Z")

</div>

Have you tried:

```bash
$ sudo npm install -g --unsafe-perm node-pre-gyp npm serialport particle-cli

```

This always works for me.

---

<div class="post-metadata">

**Author:** ![mrosen28](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@mrosen28](https://community.particle.io/u/mrosen28)\
**Post date:** [July 30, 2017, 1:08am UTC](https://community.particle.io/t/particle-cli-mac/34398/6 "2017-07-30T01:08:28Z")

</div>

The thing that worked for me:

Use Homebrew to install node, then the command from @nrobinson2000

> Michaels-MacBook-Pro:~ Mike$ brew install node  
> Updating Homebrew...  
> ==\> Auto-updated Homebrew!  
> Updated 2 taps (homebrew/core, caskroom/cask).  
> ==\> Updated Formulae  
> ammonite-repl flake8 imagemagick rakudo-star whois  
> assimp gnupg imagemagick@6 suite-sparse  
> bind gnupg@1.4 paket terragrunt  
> caddy gnuplot pgbadger typescript  
> ffmpeg heroku planck vips

> Warning: node 8.2.1 is already installed  
> Michaels-MacBook-Pro:~ Mike$ particle  
> ! Error loading module 'serialport': Could not locate the bindings file. Tried:  
> → /usr/local/lib/node\_modules/particle-cli/node\_modules/serialport/build/serialport.node  
> → /usr/local/lib/node\_modules/particle-cli/node\_modules/serialport/build/Debug/serialport.node  
> → /usr/local/lib/node\_modules/particle-cli/node\_modules/serialport/build/Release/serialport.node  
> → /usr/local/lib/node\_modules/particle-cli/node\_modules/serialport/out/Debug/serialport.node  
> → /usr/local/lib/node\_modules/particle-cli/node\_modules/serialport/Debug/serialport.node  
> → /usr/local/lib/node\_modules/particle-cli/node\_modules/serialport/out/Release/serialport.node  
> → /usr/local/lib/node\_modules/particle-cli/node\_modules/serialport/Release/serialport.node  
> → /usr/local/lib/node\_modules/particle-cli/node\_modules/serialport/build/default/serialport.node  
> → /usr/local/lib/node\_modules/particle-cli/node\_modules/serialport/compiled/6.11.1/darwin/x64/serialport.node  
> Please reinstall the CLI again using npm install -g particle-cli  
> Michaels-MacBook-Pro:~ Mike$ sudo npm install -g --unsafe-perm node-pre-gyp npm serialport particle-cli  
> npm WARN deprecated node-uuid@1.4.8: Use uuid module instead  
> /usr/local/bin/node-pre-gyp -\> /usr/local/lib/node\_modules/node-pre-gyp/bin/node-pre-gyp  
> /usr/local/bin/npx -\> /usr/local/lib/node\_modules/npm/bin/npx-cli.js  
> /usr/local/bin/npm -\> /usr/local/lib/node\_modules/npm/bin/npm-cli.js  
> /usr/local/bin/serialport-list -\> /usr/local/lib/node\_modules/serialport/bin/serialport-list.js  
> /usr/local/bin/serialport-term -\> /usr/local/lib/node\_modules/serialport/bin/serialport-terminal.js  
> /usr/local/bin/particle -\> /usr/local/lib/node\_modules/particle-cli/bin/particle.js

> > serialport@4.0.7 install /usr/local/lib/node\_modules/serialport  
> > node-pre-gyp install --fallback-to-build

> node-pre-gyp info it worked if it ends with ok  
> node-pre-gyp verb cli [ '/usr/local/bin/node',  
> node-pre-gyp verb cli '/usr/local/lib/node\_modules/serialport/node\_modules/.bin/node-pre-gyp',  
> node-pre-gyp verb cli 'install',  
> node-pre-gyp verb cli '--fallback-to-build' ]  
> node-pre-gyp info using node-pre-gyp@0.6.32  
> node-pre-gyp info using node@6.11.1 | darwin | x64  
> node-pre-gyp verb command install   
> node-pre-gyp info check checked for "/usr/local/lib/node\_modules/serialport/build/Release/serialport.node" (not found)  
> node-pre-gyp http GET [https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-darwin-x64.tar.gz](https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-darwin-x64.tar.gz)  
> node-pre-gyp http 200 [https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-darwin-x64.tar.gz](https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-darwin-x64.tar.gz)  
> node-pre-gyp info install unpacking .deps/  
> node-pre-gyp info install unpacking .deps/Release/  
> node-pre-gyp info install unpacking .deps/Release/obj.target/  
> node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/  
> node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/src/  
> node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/src/serialport.o.d  
> node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/src/serialport\_poller.o.d  
> node-pre-gyp info install unpacking .deps/Release/obj.target/serialport/src/serialport\_unix.o.d  
> node-pre-gyp info install unpacking .deps/Release/serialport.node.d  
> node-pre-gyp info install unpacking obj.target/  
> node-pre-gyp info install unpacking obj.target/serialport/  
> node-pre-gyp info install unpacking obj.target/serialport/src/  
> node-pre-gyp info install unpacking obj.target/serialport/src/serialport.o  
> node-pre-gyp info install unpacking obj.target/serialport/src/serialport\_poller.o  
> node-pre-gyp info install unpacking obj.target/serialport/src/serialport\_unix.o  
> node-pre-gyp info install unpacking serialport.node  
> node-pre-gyp info tarball done parsing tarball  
> node-pre-gyp info validate Running test command: '/usr/local/bin/node --eval 'require('/usr/local/lib/node\_modules/serialport/build/Release/serialport.node')''  
> [serialport] Success: "/usr/local/lib/node\_modules/serialport/build/Release/serialport.node" is installed via remote  
> node-pre-gyp info ok
> 
> - node-pre-gyp@0.6.36
> - npm@5.3.0
> - serialport@4.0.7
> - particle-cli@1.23.1  
> added 137 packages, removed 249 packages, updated 105 packages and moved 7 packages in 25.806s  
> Michaels-MacBook-Pro:~ Mike$ particle

> Welcome to the Particle Command line utility!  
> Version 1.23.1  
> [GitHub - particle-iot/particle-cli: Command Line Interface for Particle Cloud and devices](https://github.com/spark/particle-cli)

> Usage: particle \<command\_name\>   
> Common Commands:

> ```
> setup, list, call, get, device, identify, flash, subscribe
> compile, monitor, login, logout, help, library
> 
> ```

> Less Common Commands:  
> token, binary, cloud, config, function, keys, serial, udp  
> update, variable, webhook, wireless

> For more information Run: particle help \<command\_name\>

> Michaels-MacBook-Pro:~ Mike$

---

<div class="post-metadata">

**Author:** ![FiDel](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/fidel/32/8811_2.png) [@FiDel](https://community.particle.io/u/FiDel)\
**Post date:** [February 25, 2022, 10:18am UTC](https://community.particle.io/t/particle-cli-mac/34398/7 "2022-02-25T10:18:05Z")

</div>

I cannot get “Particle cli” to work on my new MacBook Air. On my previous Macs it works perfectly!

First, I must say that I am not a professional programmer. I have only a basic understanding of Unix/Linux…

I know this is an old thread, but I now have this problem on this new Mac:

MacBook Air (M1, 2020)  
Mac OS Big Sur v. 11.6.2

I installed Node.js and npm successfully with the download package from the Node website

node -v  
v16.14.0

npm -v  
8.3.1

I tried to follow and apply all tips above but after installing Particle package, I could not start it…

The last command I tried is this:

```auto
bash <( curl -sL https://particle.io/install-cli )

```

Result:

```cpp
PARTICLE CLI SETUP...

                                   :                                    
                                   :                                    
                                  :::                                   
                      : ::: :                       
                       ::: ::: :::                        
                         :::: ::: ::::                          
                          :::::: ::::::                           
                           :::::::::::::::::                            
                             :::::::::::::                              
                    ::::::: ::::::::::: :::::::                     
                    ::::::: ::::::::::: :::::::                     
                             :::::::::::::                              
                           ::::::::.::::::::                            
                          :::::: ::::::                           
                         :::: ::: ::::                          
                       ::: ::: :::                        
                      : ::: :                       
                                  :::                                   
                                   :                                    
                                                                        
:::: Installing the Particle CLI for darwin to "/Users/kampendaal/bin/particle"
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
(23) Failed writing body
gunzip: (stdin): unexpected end of file
:::: Done!
:::: Installing dependencies
:::: Done!
:::: Success!
:::: The Particle CLI has been installed to: "/Users/kampendaal/bin"
:::: Your "/Users/kampendaal/.bash_profile" file has been updated to properly set $PATH
:::: If you previously installed the CLI with npm, run "npm uninstall -g particle-cli"

************************************************************************
 **YOU MUST CLOSE AND REOPEN YOUR TERMINAL BEFORE CHANGES TAKE EFFECT**
 ************************************************************************

```

When I try “particle login”, the prompt returns without any reaction…

Meanwhile my Mac was downloading and installing the “Xcode developer tools” (as mentioned in the above output… Do I even need this software for Particle CLI?)

After Xcode install was done, I tried once again to install Particle CLI:

```cpp
MacBook-Air:~ kampendaal$ bash <( curl -sL https://particle.io/install-cli )

PARTICLE CLI SETUP...

                                   :                                    
                                   :                                    
                                  :::                                   
                      : ::: :                       
                       ::: ::: :::                        
                         :::: ::: ::::                          
                          :::::: ::::::                           
                           :::::::::::::::::                            
                             :::::::::::::                              
                    ::::::: ::::::::::: :::::::                     
                    ::::::: ::::::::::: :::::::                     
                             :::::::::::::                              
                           ::::::::.::::::::                            
                          :::::: ::::::                           
                         :::: ::: ::::                          
                       ::: ::: :::                        
                      : ::: :                       
                                  :::                                   
                                   :                                    
                                                                        
:::: Installing the Particle CLI for darwin to "/Users/kampendaal/bin/particle"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
KeyError: 'arm'
gunzip: (stdin): unexpected end of file
:::: Done!
:::: Installing dependencies
:::: Done!
:::: Success!
:::: The Particle CLI has been installed to: "/Users/kampendaal/bin"
:::: Your "/Users/kampendaal/.bash_profile" file has been updated to properly set $PATH
:::: If you previously installed the CLI with npm, run "npm uninstall -g particle-cli"

************************************************************************
 **YOU MUST CLOSE AND REOPEN YOUR TERMINAL BEFORE CHANGES TAKE EFFECT**
 ************************************************************************

```

Now it seems like there was a problem with one of the files:

```cpp
KeyError: 'arm'
gunzip: (stdin): unexpected end of file

```

Has this something to do with the new Apple Silicon processor?  
Any tips?

---

<div class="post-metadata">

**Author:** ![nrobinson2000](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/nrobinson2000/32/15624_2.png) [@nrobinson2000](https://community.particle.io/u/nrobinson2000)\
**Post date:** [February 26, 2022, 3:57am UTC](https://community.particle.io/t/particle-cli-mac/34398/8 "2022-02-26T03:57:35Z")

</div>

@FiDel

On M1 Macs you'll need to enable Rosetta in order to use particle-cli:

> [@ISSUE - Particle CLI on mac BigSur- not installing](https://community.particle.io/t/issue-particle-cli-on-mac-bigsur-not-installing/60955):
>
> Hello I recently migrated and older mac to a newer one running BigSur 11.5.1 (apple M1 chip) following macs process to migrate all files from old to new computer. I had Particle CLI in the old mac, and continued to work in the new one without issues (apparently). It seems the mac os migration process moved and installed all necessary files. After running a few basic commands (particle serial wifi, etc) the CLI was asking me to update to the latest version, so I did following the instructions.…

---

<div class="post-metadata">

**Author:** ![FiDel](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/fidel/32/8811_2.png) [@FiDel](https://community.particle.io/u/FiDel)\
**Post date:** [February 26, 2022, 3:53pm UTC](https://community.particle.io/t/particle-cli-mac/34398/9 "2022-02-26T15:53:37Z")

</div>

Great! I’ll try this right now!  
Thanks for the golden tip champion!  
FiDel

---

<div class="post-metadata">

**Author:** ![FiDel](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/fidel/32/8811_2.png) [@FiDel](https://community.particle.io/u/FiDel)\
**Post date:** [February 26, 2022, 4:47pm UTC](https://community.particle.io/t/particle-cli-mac/34398/10 "2022-02-26T16:47:48Z")

</div>

@nrobinson2000 : (Maybe you will prefer to continue in the other thread?)

It was a good try, but unfortunately, after another long adventure, installing Rosetta2 and following all tips in the thread you shared, Particle CLI still does not work on this M2 Mac…  
After multiple uninstalls and reinstalls, I keep getting this error:

```cpp
"KeyError: 'arm'
gunzip: (stdin): unexpected end of file":

```

So, I reinstalled is again:

```cpp
MacBook-Air:~ kampendaal$ bash <( curl -sL https://particle.io/install-cli )

PARTICLE CLI SETUP...

                                   :                                    
                                   :                                    
                                  :::                                   
                      : ::: :                       
                       ::: ::: :::                        
                         :::: ::: ::::                          
                          :::::: ::::::                           
                           :::::::::::::::::                            
                             :::::::::::::                              
                    ::::::: ::::::::::: :::::::                     
                    ::::::: ::::::::::: :::::::                     
                             :::::::::::::                              
                           ::::::::.::::::::                            
                          :::::: ::::::                           
                         :::: ::: ::::                          
                       ::: ::: :::                        
                      : ::: :                       
                                  :::                                   
                                   :                                    
                                                                        
:::: Installing the Particle CLI for darwin to "/Users/kampendaal/bin/particle"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
KeyError: 'arm'
gunzip: (stdin): unexpected end of file
:::: Done!
:::: Installing dependencies
:::: Done!
:::: Success!
:::: The Particle CLI has been installed to: "/Users/kampendaal/bin"
:::: Your "/Users/kampendaal/.bash_profile" file has been updated to properly set $PATH
:::: If you previously installed the CLI with npm, run "npm uninstall -g particle-cli"

************************************************************************
 **YOU MUST CLOSE AND REOPEN YOUR TERMINAL BEFORE CHANGES TAKE EFFECT**
 ************************************************************************

```

When testing Particle CLI, nothing happens…

```cpp
MacBook-Air:~ kampendaal$ particle login
MacBook-Air:~ kampendaal$ 

```

Thanks on beforehand for any more tips!

---

<div class="post-metadata">

**Author:** ![nrobinson2000](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/nrobinson2000/32/15624_2.png) [@nrobinson2000](https://community.particle.io/u/nrobinson2000)\
**Post date:** [February 26, 2022, 8:25pm UTC](https://community.particle.io/t/particle-cli-mac/34398/11 "2022-02-26T20:25:39Z")

</div>

Due to poorly made assumptions in the script and the lack of error checking, the `~/bin/particle` you downloaded is an empty file, marked with executable permissions.

As a workaround, I’d recommend downloading the amd64 (Intel Mac) version of `particle` directly.

```auto
curl -fsLo ~/bin/particle --create-dirs \
    https://binaries.particle.io/cli/master/1.1.0-12d6799/darwin/amd64/particle

chmod +x ~/bin/particle

```

Afterwards you should be able to log in and install additional dependencies:

```auto
particle login
brew install dfu-util
brew install openssl

```

---

<div class="post-metadata">

**Author:** ![FiDel](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/fidel/32/8811_2.png) [@FiDel](https://community.particle.io/u/FiDel)\
**Post date:** [February 26, 2022, 11:06pm UTC](https://community.particle.io/t/particle-cli-mac/34398/12 "2022-02-26T23:06:24Z")

</div>

Wow, thanks!  
I’ll try your procedure tomorrow morning…  
😴

---

<div class="post-metadata">

**Author:** ![FiDel](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/fidel/32/8811_2.png) [@FiDel](https://community.particle.io/u/FiDel)\
**Post date:** [February 27, 2022, 10:21am UTC](https://community.particle.io/t/particle-cli-mac/34398/13 "2022-02-27T10:21:57Z")

</div>

Abracadabra... It works!  
I can login and list my devices!  
Thanks a lot, I don't see how I could have done this without your help!!!

* * *

When I try to install the additional dependencies, it seems like it did not work:

> [@nrobinson2000](#):
>
> `brew install dfu-util`

Result:

```cpp
Traceback (most recent call last):
4: from /usr/local/Library/brew.rb:32:in `<main>'
3: from /usr/local/Library/Homebrew/os/mac.rb:15:in `version'
2: from /usr/local/Library/Homebrew/os/mac.rb:15:in `new'
1: from /usr/local/Library/Homebrew/os/mac/version.rb:24:in `initialize'
/usr/local/Library/Homebrew/version.rb:170:in `initialize': Version value must be a string (TypeError)

```
