User local install as much as possible, leaving system-wide kit alone, and no mega-distributions such as homebrew. Tested all the way through Ventura.
Make sure SSH is set up. Allow a remote computer to access your Mac and generate a new SSH Key. See appendix below.
There is automatically an ssh agent. Just use ssh-add. Note: if you use 1password, it has SSH agent management you can use.
Install XCode from the App Store, then install Xcode Command Line Tools
xcode-select --install
Default shell is zsh. You'll probably want Oh My Zsh:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
It does come with some nice shortcuts.
Git comes with XCode, but you might have to follow the prompt to install XCode cmdline tools when you first run it. You'll want to configure it as in ~/.gitconfig. Replace name & email in the following terminal commands:
$ git config --global user.name "John Doe"
$ git config --global user.email "john.doe@gmail.com"
You may just want to copy in or create a ~/.gitconfig. If so Tania Rascia has a sample with some nice, suggested aliases. (Scroll down to Git section).
You may also want to set up a ~/.gitignore (there is an example in the SaKKo link above), though I prefer to have these project by project, so the exclusions can be distributed to collaborators.
The downloads page should detect your OS and present you with a mac download of the latest
Launch the downloaded installer. The key file installed is /usr/local/bin/python3. Note: do not mess with the system-installed Python kit, e.g. /usr/bin/python and /usr/bin/python3. This will be easier if you do everything using virtual environments.
Python includes its own private copy of OpenSSL. A command script is included in /Applications/Python 3.x to install a curated bundle of default root certificates from certifi. The Python 3.x folder should should pop up in Finder after install. Double-click on "Install Certificates". If not, you can go to Applications, double-click the version of Python you installed to reveal an Install Certificates.command and double-click that. If you skip this step, you'll run into ssl.SSLCertVerificationError (certificate verify failed) errors at some point.
If you fail to do this, you may run into errors such as:
So many options! I paid for iClip a while back, so I just use that. Free alternatives include:
- Maccy. Click the
Download Nowbutton, rather than theGet in App Storebutton, then enter0for theName a fair price:box, then you can download the app for free. - Jumpcut.
To be honest I haven't found an editor I've liked unreservedly since the days of the Turbo C IDE and Brief, but these days I'm mostly using Visual Studio Code. Download and install.
uv really has become a nice way to manage virtual envs and Python versions. To install:
curl -LsSf https://astral.sh/uv/install.sh | shYou should now have uv & uvx in $HOME/.local/bin
This is the standalone installer, so from time to time you can update uv itself as follows:
uv self update
Enable shell autocompletion:
echo 'eval "$(uv generate-shell-completion zsh)"' >> ~/.zshrc
echo 'eval "$(uvx --generate-shell-completion zsh)"' >> ~/.zshrc
source ~/.zshrcYou should now be good to go.
You can still use virtual envs with or without uv.
Prepare:
mkdir -p $HOME/.local/venv
Creating a venv:
export DEVENVTAG=main
/usr/local/bin/python3 -m venv $HOME/.local/venv/$DEVENVTAG
You only need to specify the full path to Python when creating the venv, as above.
Activating:
source $HOME/.local/venv/$DEVENVTAG/bin/activate
pip install --upgrade pip #Needed from time to time, to make sure pip itself is up to date
pip install wheel #One time per venv. Allows pip to install pre-compiled os-specific versions. Also you might get odd errors if you omit this.
In future you only need the first line above to activate the venv.
If you work with web tech you want all the tools. Mac dev includes cURL, but not wget, so we remedy that. Unfortunately it's complex without using HomeBrew.
Start with openssl
cd ~/Downloads
curl -LO https://github.com/openssl/openssl/releases/download/openssl-3.6.0/openssl-3.6.0.tar.gz
cd ~/src
tar xvf ~/Downloads/openssl-*
cd openssl-*
./config --prefix=$HOME/.local
make
make install
Then wget
cd ~/Downloads
curl -O https://ftp.gnu.org/gnu/wget/wget-latest.tar.lz
cd ~/src
tar xvf ~/Downloads/wget-latest.tar.lz
cd wget*
OPENSSL_CFLAGS="-I$HOME/.local/include" OPENSSL_LIBS="-L$HOME/.local/lib -lssl -lcrypto" \
./configure --with-ssl=openssl --prefix=$HOME/.local
make
make install
If you prefer HTTPie, you can just install that via pip. cURL is fundamental, though.
I prefer to use an Ed25519 key. Make sure you change the my_name in the first line.
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "my_name.macbook"
# eval "$(ssh-agent -s)" # Not needed on Mac Catlina
ssh-add ~/.ssh/id_ed25519
cat .ssh/id_ed25519.pub
# Paste in GitHub/GitLab/etc.I needed to use GNU Parallel and all the install guides I could find were for Homebrew. I did it without by following the Prerequisites section of the GNU Parallel tutorial.
export CPPFLAGS=-'I$HOME/.local/include'
export LD_LIBRARY_PATH='-L$HOME/.local/lib'
export DYLD_LIBRARY_PATH='-L$HOME/.local/lib'
Alternative to above:
Create config.site in $HOME/.local and set following content:
CPPFLAGS=-I$HOME/.local/include
LDFLAGS=-L$HOME/.local/lib
DYLD_LIBRARY_PATH=-L$HOME/.local/lib
Then set CONFIG_SITE in environment to that file:
Edit $HOME/.zshenv and add:
export PATH="$HOME/.local/bin:$PATH"
export CONFIG_SITE="$HOME/.local/config.site"
And re-source:
source $HOME/.zshenv
Download and untar libevent & tmux. Go into the libevent then tmux dir & in each do:
./configure --prefix=$HOME/.local
make
make install
Highly recommended: tmux-continuum & tmux-resurrect to automatically persist tmux session state for post tmux server restart (or reboot).
To try: tmuxinator for managing tmux sessions, and e.g. nice recovery after tmux server restart (or reboot).
Notes:
- Nice tmux cheat sheet
- Useful brief on proper zsh config (which the Mac install doesn't necessarily seem to follow)
- H/T this non-brew tmux guide
Note: it's become way to fiddly to build Python by hand on Mac OS X, what with SSL issues etc. Just install an updated framework version via .pkg on https://www.python.org/
mkdir -p $HOME/.local/venv
mkdir -p ~/src
cd ~/Downloads
# Haven't got wget working yet
curl -O https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tar.xz
cd ~/src
tar xvf ~/Downloads/Python-3.10*
cd Python-3.10*
./configure --enable-optimizations --prefix=$HOME/.local
make
make install
Note: I was seeing at one point (on M1 Mac): configure: error: check config.log and use the '--with-universal-archs' option
Ended up having to reinstall XCode cmdline tools using following recipe:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools
At which point configure worked.
You'll need these to build a lot of project sform scratch if, like me, you prefer to avoid homebrew & macports. Download latest (might be from 2021) from https://ftp.gnu.org/gnu/autoconf/
tar xvf /Users/uche/Downloads/autoconf-latest.tar.xz
cd autoconf-2.71
./configure --prefix=$HOME/.local
make
make installTODO: Document the above also for flex, bison > 3.0, libtool, make & automake, in order to built jq
[Only relevant to pre 2020 Macs]
If you are unfortunate enough to be on one of the Macs without a proper Escape key (models from ca. 2016-2019), your best bet might involve losing your Caps Lock. Go into System Preferences > Keyboard and look for the Modifier Keys button in the lower right of the dialog. Select the drop-down nxt to Caps Lock and reset it to Escape.