Install Xcode Command Line Tools.
xcode-select --install
Install Homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install Git.
brew install git
git config --list
git config --global user.name "My Name"
git config --global user.email "[email protected]"
git config --global color.ui true
Install SQLite.
brew install sqlite
echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc
Install PostgreSQL.
brew install postgresql@16
echo 'export PATH="/usr/local/opt/postgresql@16/bin:$PATH"' >> ~/.zshrc
Install pyenv.
curl https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
exec "$SHELL"
Install Python build dependencies.
brew install openssl readline sqlite3 xz zlib tcl-tk
Build and install Python on macOS with configuration options. See #333 for troubleshooting.
brew install pkg-config [email protected] xz gdbm tcl-tk
env \
LDFLAGS="-L/usr/local/opt/sqlite/lib -L/usr/local/opt/postgresql@16/lib" \
CPPFLAGS="-I/usr/local/opt/sqlite/include -I/usr/local/opt/postgresql@16/include" \
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
PYTHON_CONFIGURE_OPTS="--with-pydebug --with-openssl=$(brew --prefix [email protected])" \
pyenv install 3.12.0
pyenv global 3.12.0
Install Django.
mkdir myproject && cd myproject/
python -m venv venv
source venv/bin/activate
pip install --upgrade pip django
django-admin startproject myproject
python myproject/manage.py migrate
python myproject/manage.py runserver