Installing Safety CLI via Binary
Overview
Safety CLI can be installed using three different methods: pip, uv, or pre-compiled binaries. This guide covers the binary installation method.
Benefits of Binary Installation
Installing Safety via binaries offers several advantages:
No Python Required: Safety runs as a standalone executable, eliminating Python installation and version management
Zero Dependency Conflicts: Completely isolated from your Python environment and projects
Faster Startup: Pre-compiled binaries start faster than Python-based installations
Simplified CI/CD: Easier integration into build pipelines without Python environment setup
Consistent Performance: Guaranteed consistent behavior across different environments
Smaller Footprint: No need to install and manage Python dependencies
Prerequisites
Before installing Safety via binary, ensure you have:
Linux/macOS:
curlinstalled (typically pre-installed)Windows: PowerShell 5.0 or later (included in Windows 10+)
Internet connection to download the binary from GitHub releases
Uninstalling Existing Safety Versions
If you already have Safety installed through pip or uv, you must uninstall it first to avoid conflicts between the global binary and Python package installations.
Check Current Installation
First, verify if Safety is currently installed and identify the installation method:
safety --version
which safety # Linux/macOS
where safety # WindowsUninstall Python-based Installations
If installed via pip:
pip uninstall safetyIf installed via uv tool:
uv tool uninstall safetyIf installed in a virtual environment:
If Safety was installed in a virtual environment, you don't need to uninstall it unless you want the binary to be your primary Safety installation. The binary will be installed globally and take precedence when called from outside virtual environments.
Verify Uninstallation
After uninstalling, verify that Safety is no longer available:
safety --versionThis command should return "command not found" or similar. If it still shows a version, check for additional installations:
# Linux/macOS: Check all Safety installations
which -a safety
# Windows: Check all Safety installations
where /R C:\ safety.exeInstalling Safety CLI Binary
The binary installation uses a shell script (Linux/macOS) or PowerShell script (Windows) that automatically:
Detects your operating system and architecture
Downloads the appropriate pre-compiled binary from GitHub releases
Installs Safety to your system PATH
Makes the
safetycommand available globally
Windows
Run the following command in PowerShell (as Administrator recommended):
powershell -ExecutionPolicy ByPass -c '$env:SAFETY_LATEST_TAG=1; irm https://getsafety.com/cli/install.ps1 | iex'What this does:
-ExecutionPolicy ByPass: Temporarily bypasses PowerShell execution restrictions for this installation$env:SAFETY_LATEST_TAG=1: Sets the environment variable to download the latest version, including prereleasesirm: PowerShell alias forInvoke-RestMethod(downloads the script)iex: PowerShell alias forInvoke-Expression(executes the script)
Installation Location
After installation, the Safety binary will be available globally:
Windows: Typically installed to
%USERPROFILE%\.safety\bin\safety.exe
Linux and macOS
Run the following command in your terminal:
curl -LsSf https://getsafety.com/cli/install.sh | SAFETY_LATEST_TAG=1 shWhat this does:
curl -LsSf: Downloads the installation script-L: Follows redirects-s: Silent mode (no progress bar)-S: Shows errors if they occur-f: Fails silently on server errors
SAFETY_LATEST_TAG=1: Flag to download the latest available version (including pre-releases)sh: Executes the installation script
Installation Location
After installation, the Safety binary will be available globally:
Linux/macOS: Typically installed to
~/.local/bin/safetyor/usr/local/bin/safety
Verifying Installation
After installation completes, verify that Safety is installed correctly:
safety --versionThis should display the installed Safety version. You can also check the installation location:
which safety # Linux/macOS
where safety # WindowsImportant Notes and Troubleshooting
Download Speed and Rate Limiting
The installation script downloads binaries directly from GitHub releases. If you experience slow downloads or timeouts:
GitHub Rate Limiting: Unauthenticated GitHub API requests are limited. Downloads may take up to 3 minutes depending on GitHub's current rate limits and your location
Network Issues: Ensure you have a stable internet connection
Future Improvement: CloudFront-based distribution is planned to improve download speeds and reliability
Version Control
The SAFETY_LATEST_TAG=1 flag ensures you receive the latest available version:
Includes both stable releases and pre-releases
If you need a specific version, this flag can be adjusted once additional version options are available
Permission Issues
Linux/macOS: If you encounter permission errors during installation:
# Try with elevated permissions
curl -LsSf https://getsafety.com/cli/install.sh | sudo SAFETY_LATEST_TAG=1 shWindows: Run PowerShell as Administrator if you encounter access denied errors.
PATH Configuration
If the safety command is not found after installation:
Linux/macOS: Add the installation directory to your PATH by adding this line to your ~/.bashrc, ~/.zshrc, or equivalent:
export PATH="$HOME/.local/bin:$PATH"Then reload your shell configuration:
source ~/.bashrc # or ~/.zshrcWindows: The installer should automatically add Safety to your PATH. If not, manually add the installation directory to your system PATH through System Properties > Environment Variables.
Next Steps
After successfully installing Safety CLI, proceed to authenticate with your Safety account:
For detailed authentication instructions, see the Installation and Authentication guide.
Switching Between Installation Methods
If you want to switch from binary installation back to pip or uv:
Remove the binary from your system PATH (location varies by OS)
Install using your preferred method:
pip install safetyoruv pip install safetyVerify the installation:
safety --versionand check the installation path
Note: Binary installation is currently in preview. Once fully production-ready, this will become a recommended installation method alongside pip and uv options.
Last updated
Was this helpful?

