- at 50 Mbps on a recent Mac, the 50 MB download including install takes about 30 seconds ;-)
- Usage: copy one of the two following lines and paste it into your terminal
v=3; f=Miniconda${v}-latest-MacOSX-x86_64.sh; cd $TMPDIR; { curl -LfOsS https://repo.anaconda.com/miniconda/$f ; cd -; } && bash $TMPDIR/$f -b && echo ". ~/miniconda${v}/etc/profile.d/conda.sh" >> ~/.bash_profile; . ~/miniconda${v}/bin/activate
v=2; f=Miniconda${v}-latest-MacOSX-x86_64.sh; cd $TMPDIR; { curl -LfOsS https://repo.anaconda.com/miniconda/$f ; cd -; } && bash $TMPDIR/$f -b && echo ". ~/miniconda${v}/etc/profile.d/conda.sh" >> ~/.bash_profile; . ~/miniconda${v}/bin/activate
- To activate the (base) virt. env. manually in another shell use
conda activate
- To create another virtual environment and activate / list / deactivate:
conda create --name project1
conda activate project1
conda info --envs
...
conda deactivate
conda deactivate >/dev/null 2>&1; rm -rf ~/miniconda{2,3}; sed -i.bak '/. ~\/miniconda*/d' ~/.bash_profile
# Python version 2 or 3
v=3;
# Download latest miniconda 64 bit
# https://docs.conda.io/en/latest/miniconda.html
f=Miniconda${v}-latest-MacOSX-x86_64.sh;
# Use a temporary dir such as: /var/folders/9l/wwt.../T/
cd $TMPDIR;
# Use Curl as macOS does not come with wget
# Options: curl --location --fail --remote-name --silent --show-error
# switch back to previous dir
{ curl -LfOsS https://repo.anaconda.com/miniconda/$f ; cd -; } &&
# Use the miniconda installer to install in silent mode
bash $TMPDIR/$f -b &&
# Add miniconda to the PATH, while not enabling auto-activation in every shell
echo ". ~/miniconda${v}/etc/profile.d/conda.sh" >> ~/.bash_profile;
# Activate a virtual environment in the current shell
. ~/miniconda${v}/bin/activate
The only difference is, that this will add a much bigger section to the .bash_profile, which by default auto-activates the base environment in every shell, unless you disable that with conda config --set auto_activate_base false
, as added below.
v=3; f=Miniconda${v}-latest-MacOSX-x86_64.sh; cd $TMPDIR; { curl -LfOsS https://repo.anaconda.com/miniconda/$f ; cd -; } && bash $TMPDIR/$f -b && . ~/miniconda${v}/bin/activate && conda init && conda config --set auto_activate_base false
v=2; f=Miniconda${v}-latest-MacOSX-x86_64.sh; cd $TMPDIR; { curl -LfOsS https://repo.anaconda.com/miniconda/$f ; cd -; } && bash $TMPDIR/$f -b && . ~/miniconda${v}/bin/activate && conda init && conda config --set auto_activate_base false
- based on: https://docs.anaconda.com/anaconda/install/mac-os/#using-the-command-line-install
- and https://docs.anaconda.com/anaconda/install/silent-mode/
- the latest version of Miniconda Python may not work on older OS versions, substitute the following:
- Mavericks 10.9.5 use
Miniconda3-4.5.11-MacOSX-x86_64.sh
(updates to conda version : 4.8.3, python version : 3.7.2.final.0)