---
# System prepended metadata

title: Anvio Install for M2 (and zsh)

---


Creating the python 3.7 conda environment (using osx-64)
```
CONDA_SUBDIR=osx-64 conda create -y --name anvio-dev python=3.7  # Create a new environment called your_environment_name with intel packages.
conda activate anvio-dev # activate your environment
conda config --env --set subdir osx-64  # Make sure that conda commands in this environment use intel packages.
```
> Note: Users must have installed [Rosetta2](https://support.apple.com/en-us/HT211861)



Adding the update script (bash or zsh):
```
mkdir -p "${CONDA_PREFIX}/etc/conda/activate.d/"
SHELL_NAME=$(basename "$SHELL")

if [ "$SHELL_NAME" = "zsh" ]; then
  # Zsh shell
  cat <<EOF >"${CONDA_PREFIX}/etc/conda/activate.d/anvio.sh"
# creating an activation script for the conda environment for anvi'o
# development branch so (1) Python knows where to find anvi'o libraries,
# (2) the shell knows where to find anvi'o programs, and (3) every time
# the environment is activated, it synchronizes with the latest code from
# the active GitHub repository:
export PYTHONPATH=\$PYTHONPATH:${PWD}/anvio/
export PATH=\$PATH:${PWD}/anvio/bin:${PWD}/anvio/sandbox
echo -e "\033[1;34mUpdating from anvi'o GitHub \033[0;31m(press CTRL+C to cancel)\033[0m ..."
cd ${PWD}/anvio && git pull && cd -
EOF
else
  # Bash shell (default to the original script)
  cat <<EOF >"${CONDA_PREFIX}/etc/conda/activate.d/anvio.sh"
# creating an activation script for the conda environment for anvi'o
# development branch so (1) Python knows where to find anvi'o libraries,
# (2) the shell knows where to find anvi'o programs, and (3) every time
# the environment is activated, it synchronizes with the latest code from
# the active GitHub repository:
export PYTHONPATH=\$PYTHONPATH:${PWD}/anvio/
export PATH=\$PATH:${PWD}/anvio/bin:${PWD}/anvio/sandbox
echo -e "\e[1;34mUpdating from anvi'o GitHub \e[0;31m(press CTRL+C to cancel)\e[0m ..."
cd ${PWD}/anvio && git pull && cd -
EOF
fi
```

You may also be interested in creating the environment via a conda environment file instead of doing via command line 

trying to clean this up a bit:

```
mkdir -p "${CONDA_PREFIX}/etc/conda/activate.d/"
SHELL_NAME=$(basename "$SHELL")

# Define color/formatting codes for different shells
if [ "$SHELL_NAME" = "zsh" ]; then
  # Zsh shell
  blue_text=$(tput setaf 4)
  red_text=$(tput setaf 1)
  reset_text=$(tput sgr0)
else
  # Bash shell (default to original formatting)
  blue_text="\033[1;34m"
  red_text="\033[0;31m"
  reset_text="\033[0m"
fi

# Create the activation script with the common code block
cat <<EOF >"${CONDA_PREFIX}/etc/conda/activate.d/anvio.sh"
# creating an activation script for the conda environment for anvi'o
# development branch so (1) Python knows where to find anvi'o libraries,
# (2) the shell knows where to find anvi'o programs, and (3) every time
# the environment is activated, it synchronizes with the latest code from
# the active GitHub repository:
export PYTHONPATH=\$PYTHONPATH:${PWD}
export PATH=\$PATH:${PWD}/bin:${PWD}/sandbox
echo -e "${blue_text}Updating from anvi'o GitHub ${red_text}(press CTRL+C to cancel)${reset_text} ..."
cd ${PWD}/anvio && git pull && cd -
EOF

```