macOS
Installation on macOS (bash/zsh)
1. Prerequisites
macOS 12 or later
Homebrew (optional but recommended)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Terminal: Built-in Terminal.app or iTerm2
2. Install Node.js (v22+) & npm
You can choose Homebrew or nvm for managing Node:
A. Homebrew
brew update
brew install node@22
# Ensure in your PATH:
echo 'export PATH="/opt/homebrew/opt/node@22/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
B. nvm (Node Version Manager)
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
Load nvm (add to
~/.zshrc
or~/.bash_profile
):export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Install/use Node 22:
nvm install 22 nvm use 22 node --version # v22.x.x
C. Verify
node --version # expect v22.x.x or higher
npm --version
3. Gatekeeper & Remote-Signed Files
Issue: “Cannot open ‘xyz’ because Apple cannot check it for malicious software.”
Unblock downloaded files:
xattr -dr com.apple.quarantine ~/Downloads/<file>
Allow apps from anywhere (requires sudo):
sudo spctl --master-disable
⚠️ Use sparingly; re-enable with
sudo spctl --master-enable
4. Install the P0 CLI
npm install -g @p0security/cli
If you hit EACCES or permissions errors:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share} npm install -g @p0security/cli
Verify
p0 --version
p0 help
5. macOS Shell Setup
Ensure
/usr/local/bin
(or/opt/homebrew/bin
) is in your PATH:echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
Enable command-completion:
# in ~/.zshrc autoload -Uz compinit && compinit
8. Proxy & Corporate Networks
Issue:
npm install
stalling orp0 login
failing behind proxy.
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
# Shell env vars:
export HTTP_PROXY="http://proxy.company.com:8080"
export HTTPS_PROXY="http://proxy.company.com:8080"
Add these to ~/.zshrc
so they persist.
9. Common Troubleshooting
zsh: command not found: p0
– Restart your terminal to reload PATH.– Check npm root -g
and ensure p0
is there.
EACCES “permission denied”
– Fix ownership: sudo chown -R $(whoami) $(npm config get prefix)/*
AWS CLI not found in scripts
– Ensure Homebrew’s bin (/usr/local/bin
or /opt/homebrew/bin
) is in your PATH.
CLI hangs on p0 login
– Check $BROWSER
env var: export BROWSER=open
– If using Safari, allow pop-ups.
Last updated