Skip to content

macOS๐Ÿ”—

Developer Setup

NOTE: at some point you will be prompted to install the โ€œCommand Line Developer Toolsโ€ for Xcode. This is a large download. Be prepared.

Python๐Ÿ”—

Mac still ships with python 2, but one day maybe it wonโ€™tโ€ฆ

I prefer using conda to manage python anyway, so my install notes works just fine for me.

Bash
# Note, this uses macOS Apple M1 installer. Use apple menu -> About This Mac to check if โ€œChipโ€ is Apple M1

# Download
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o conda_installer.sh

# Install with human prompts, agree to license and conda init
bash conda_installer.sh

# Cleanup your computer
rm conda_installer.sh


# (if needed for script) Silent Install
bash conda_installer.sh -b
source miniconda3/bin/activate && conda init zsh 

In a new Terminal, update python version to desired 3.9 or 3.10 or what have you

Bash
conda install python=3.10

Add packages you might want for development and testing. (This is where I had to install Xcode developer tools in order to build python packages)

Bash
pip install black flake8 isort pep8-naming pytest-cov

Optionally install tools from the Project Jupyter ecosystem:

Bash
1
2
3
4
# Just jupyter notebook server
pip install notebook 
# Jupyterlab capability
pip install jupyterlab

VS Code๐Ÿ”—

  • Download the Mac installer (it should choose the correct version for your system)
  • Unzip it from your browser downloads or Finder -> Downloads
  • Move the โ€œVisual Studio Codeโ€ Application to Applications if desired
  • Delete the Installer zip if desired

NOTE: I couldnโ€™t find the correct link to download with curl

Extensions๐Ÿ”—

  • Dracula (theme)
  • Python Specific
  • Python (Microsoft official)
  • Python Docstring Generator (Nils Werner)
  • Even Better TOML (tamasfe)
  • General VS Code
  • indent-rainbow (oderwat): Visualize deeply indented blocks more easily
  • GitLens (Eric Amodio): Quickly check git history of files, branches, lines, etc.
  • Various File Types
  • Markdown All in One (Yu Zhang)
  • Markdown navigation (AlanWalk)
  • markdownlint (David Anson)
  • Paste Image (mushan)
  • Markdown Preview Github Styling (Matt Bierner)
  • Markdown Emoji (Matt Bierner)
  • Docker (Microsoft)
  • YAML (Red Hat)
  • XML (Red Hat)
  • SQL Formatter (adpyke)

Settings๐Ÿ”—

I tend to put these in the VS Code settings (cmd + shift + p then type "settings JSON" for one way to get there).

A lot of these are Python experience and specific to using flake8, black, and isort. These are the first several up to and including the "autoDocstring" entry.

That said, there's some that are useful for general editing, searching large code bases, and working with the integrated terminal. Shoutout to Harald Kirschner's tips (and presentation).

JSON
{
    "python.condaPath": "~/miniconda3/bin/conda",
    "python.defaultInterpreterPath": "~/miniconda3/bin/python",
    "python.formatting.provider": "black",
    "python.linting.flake8Enabled": true,
    "python.linting.enabled": true,
    "python.testing.pytestEnabled": true,
    "python.sortImports.path": "isort",
    "python.sortImports.args": [
        "--profile black"
    ],
    "python.terminal.executeInFileDir": true,
    "jupyter.askForKernelRestart": false,
    "terminal.integrated.inheritEnv": false,
    "autoDocstring.startOnNewLine": true,
    "workbench.colorTheme": "Dracula Soft",
    "telemetry.telemetryLevel": "off",
    "security.workspace.trust.untrustedFiles": "open",
    "files.autoSave": "onFocusChange",
    "terminal.integrated.allowChords": false,
    "search.mode": "reuseEditor",
    "search.searchEditor.doubleClickBehaviour": "openLocationToSide",
    "files.defaultLanguage": "${activeEditorLanguage}",
    "workbench.editor.pinnedTabSizing": "shrink",
    "editor.minimap.enabled": false,
    "diffEditor.ignoreTrimWhitespace": false,
}

Keybindings๐Ÿ”—

Some things are worth changing for productivity and matching other tools.

  • Jump to beginning of text in the line: ctrl + a
  • Jump to top / bottom of file: shift + cmd + , and shift + cmd + /
  • From Emacs muscle memory trying to get something similar
JSON
[
    {
        "key": "ctrl+a",
        "command": "cursorHome"
    },
    {
        "key": "shift+cmd+,",
        "command": "cursorTop",
        "when": "textInputFocus"
    },
    {
        "key": "shift+cmd+/",
        "command": "cursorBottom",
        "when": "textInputFocus"
    },
    {
        "key": "shift+cmd+,",
        "command": "-editor.action.inPlaceReplace.up",
        "when": "editorTextFocus && !editorReadonly"
    }
]

Docker๐Ÿ”—

For running applications and mocking linux filesystems.

Docker recommends installing Rosetta 2 when running on Apple Silicon. This will install it to translate from Intel to M1:

Bash
softwareupdate --install-rosetta
  • Download the .dmg
  • Open and .dmg then drag the Docker Application into Applications
  • Search or open Docker from spotlight
  • Accept terms and conditions
  • Try to run the hello world application
Bash
docker run -rm hello-world

Github๐Ÿ”—

I use SSH keys to connect to github / gitlab / etc. for convenience and making the connection work out of the box from tools like VS Code.

Set Default Git User๐Ÿ”—

Set your preferences so tools like VS Code will use these on your commits by default.

Bash
git config --global user.name "Your Name Here" 
git config --global user.email "your_email@your_domain.com"

Create SSH Key๐Ÿ”—

It's best to create new keys for new machines as opposed to copying an old key from one machine to another. Use a password if other people have access to your machine, otherwise feel free to leave blank.

Bash
ssh-keygen -t ed25519 -f ~/.ssh/github_key

Add Github to SSH Config๐Ÿ”—

To make sure this key gets used when we try to authenticate to Github, we'll add the following entry to ~/.ssh/config:

Text Only
1
2
3
Host github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/github_key

To do this with a terminal editor use one of the following:

Bash
1
2
3
nano ~/.ssh/config
vim ~/.ssh/config
ed ~/.ssh/config

To do this with a GUI editor, you have to make sure the file exists first:

Bash
touch ~/.ssh/config
open ~/.ssh/config

Add Public Key to Github๐Ÿ”—

Copy your public key to the clipboard with the following:

Bash
pbcopy < ~/.ssh/github_key.pub

Alternatively you can paste it out and copy by hand:

Bash
cat ~/.ssh/github_key.pub

NOTE: be sure you are copying your .pub Public key, and not the Private key

  • Navigate to your github Account -> Settings -> SSH and GPG keys (under "Access", or this link)
  • Select New SSH Key

Github SSH and GPG keys page

  • Enter a nickname for your machine
  • Paste the Public key into the main text area

Github add SSH key page

Test Authentication๐Ÿ”—

This command should spit out a message like Hi {username}! You've successfully authenticated if successful.

Bash
ssh -T git@github.com

Homebrew๐Ÿ”—

See main site: โ€œInstalls the stuff you need that Apple didnโ€™tโ€

Bash
1
2
3
4
5
# Grab and install homebrew from latest GitHub release
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add to PATH
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/gar/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Amethyst๐Ÿ”—

Window Tiling Manager for macOS 10.12+ by ianyh. For splitting windows left and right, full screen, quarters, etc.

Bash
brew install --cask amethyst

Open application and grant Accessibility Privacy permissions in Security & Privacy System Preferences


Last update: June 7, 2023
Created: June 7, 2023