PATH Management
Launchpad includes automatic PATH management to ensure that installed packages and tools are accessible from your terminal.
How PATH Management Works
When you install packages or create shims with Launchpad, the binaries are typically placed in directories like /usr/local/bin
or ~/.local/bin
. For these binaries to be accessible from anywhere in your terminal, these directories need to be in your PATH environment variable.
Launchpad can automatically:
- Check if the relevant directories are in your PATH
- Add them to your shell configuration files if they're not
- Provide instructions for sourcing your updated configuration
Automatic PATH Updates
By default, Launchpad will automatically update your PATH when needed:
# This will add the shim directory to PATH if it's not already there
launchpad shim node
launchpad dev
Disabling Automatic PATH Updates
If you prefer to manage your PATH yourself, you can disable automatic updates:
# Disable for a specific command
launchpad shim --no-auto-path node
# Or in your configuration
# ~/.launchpadrc or launchpad.config.ts
{
"autoAddToPath": false
}
Supported Shell Configuration Files
Launchpad looks for and modifies these shell configuration files (in order of precedence):
~/.zshrc
- for Zsh users~/.bashrc
- for Bash users~/.bash_profile
- alternative for Bash users
The changes made look like:
# Added by launchpad
export PATH="/home/user/.local/bin:$PATH"
Cross-platform Support
Unix-like Systems (macOS, Linux)
On Unix-like systems, Launchpad modifies shell configuration files directly.
Windows
On Windows, Launchpad cannot directly modify the PATH. Instead, it provides instructions for adding directories to your PATH:
[System.Environment]::SetEnvironmentVariable('PATH', $env:PATH + ';C:\path\to\shims', [System.EnvironmentVariableTarget]::Machine)
Applying PATH Changes
After PATH updates, you need to apply the changes to your current terminal session:
# For Zsh
source ~/.zshrc
# For Bash
source ~/.bashrc # or ~/.bash_profile
Launchpad will provide these instructions when it updates your PATH.
Verifying PATH Configuration
To verify that a directory is in your PATH:
echo $PATH
This will display all directories in your PATH, separated by colons (on Unix-like systems) or semicolons (on Windows).
Troubleshooting
If you're having issues with PATH management:
Manual PATH addition:
bash# For Zsh/Bash echo 'export PATH="~/.local/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc source ~/.zshrc # or ~/.bashrc
Check directory existence:
bashls -la ~/.local/bin # or your shim directory
Verify executable permissions:
bashls -la ~/.local/bin/node # replace 'node' with your shim # Should show -rwxr-xr-x (executable)
Restart your terminal - Some changes require a terminal restart to take effect.