Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save repentsinner/18b54a95c4819d4cb5f8bf2d81da62c8 to your computer and use it in GitHub Desktop.
Save repentsinner/18b54a95c4819d4cb5f8bf2d81da62c8 to your computer and use it in GitHub Desktop.
Set up a python development environment (macOS)
#!/bin/sh
# Install Homebrew (macOS package manager)
# consider using spack (https://spack.io/) when it better supports fish
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
# Install fish (A better shell)
curl -Lo ~/Downloads/fish-3.0.2.pkg https://github.com/fish-shell/fish-shell/releases/download/3.0.2/fish-3.0.2.pkg
sudo installer -pkg ~/Downloads/fish-3.0.2.pkg -target /
# Set fish as default login shell
# See here for additional options: https://gist.github.com/idleberg/9c7aaa3abedc58694df5
sudo echo /usr/local/bin/fish >> /etc/shells
chsh -s /usr/local/bin/fish
# Restart your shell to activate / test fish
exec fish
# Install git
brew install git
# Install git-flow
brew install git-flow
# Install fisherman (A fish plugin manager)
curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs https://git.io/fisher
# Install asdf (a language manager)
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
echo 'source ~/.asdf/asdf.fish' >> ~/.config/fish/config.fish
mkdir -p ~/.config/fish/completions; and cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions
#brew install pyenv
#echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
#fisher pyenv
# Install python and set global version
# But first, workaround for missing zlib dependency https://github.com/pyenv/pyenv/issues/1219 😒
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
asdf plugin-add python
asdf install python 3.7.3
asdf global python 3.7.3
# Install pipenv (a python virtualenv manager)
pip install --upgrade pip
pip install pipenv
asdf rehash python 3.7.3
fisher add kennethreitz/fish-pipenv
# Fix config race condition as described here: https://github.com/fisherman/pipenv/issues/1#issuecomment-385205034
# and here: https://github.com/kennethreitz/fish-pipenv
set -U fish_user_paths ~/.asdf/shims $fish_user_paths
# Configure Pipenv to store .venv folders in project folder
set -Ux PIPENV_VENV_IN_PROJECT 1
# Restart your shell
exec fish
# Now you can actually develop shit without fucking everything up all the time *
# **Unless all these intructions fucked everything up. Which is likely. So good luck unwrapping the snake spaghetti**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment