Brev.dev, inc of San Francisco, California, USA has been acquired by NVIDIA Corporation of Santa Clara, California, USA on July 2024

BlogPricing

Environment variables in the setup script

The .brev scripts executes once a Brev machine is provisioned, but are not preserved. You must instead add environment variables to a ~/.bashrc or ~/.zshrc file that gets sourced.


For example, to install python's package manager pip which requires modifying the path, you'll need to first install pip:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
rm get-pip.py

You'll need to instead put this new path in your zshrc and bashrc and source both files.

printf "\n%s\n" "export PATH=$HOME/.local/bin:$PATH" | tee -a ~/.bashrc | tee -a ~/.zshrc

# Instead of exporting the variable:
# export PATH=/home/brev/.local/bin:$PATH

Here's the full snipped to add to .brev for properly installing pip:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
rm get-pip.py

echo "" >> ~/.zshrc
echo "export PATH=$HOME/.local/bin:$PATH" >> ~/.zshrc
echo "" >> ~/.bashrc
echo "export PATH=$HOME/.local/bin:$PATH" >> ~/.bashrc
source ~/.zshrc
source ~/.bashrc