This gist documents the setup of my Mac, primarily for personal use and data science.
Hardware/software details:
- MacBook Air (M1, 2020)
- Big Sur (11.2.2)
- Install HomeBrew
- Install the following with homebrew:
- Alfred
- 1password
- VSCode
- Mini-forge
- Starship cross-shell prompt
- Imagemagick
- Inkscape
- Spotify
- Zoom
- Slack
- karabiner-elements (for mechanical keyboard)
- R
- RStudio
- zsh-autosuggestions
- zsh-syntax-highlighting
- nano
- postgresql
- postgis
- Change shortcut to Cmd + Spacebar
- Configure as desired (e.g., change file search preferences, add code snippets, install workflows, etc.)
- Workflows:
- Create config file:
nano ~/.config/starship.toml - Add the following (other options can be found in the starship documentation):
[directory]
truncate_to_repo = true
truncation_length = 3
truncation_symbol = "β¦/"
[conda]
format = "[$symbol$environment](bold green) "
[python]
format = "[$symbol$version](bold yellow) "
[git_status]
conflicted = "π³"
ahead = "ππ¨"
behind = "π°"
diverged = "π΅"
untracked = "π€·β"
stashed = "π¦"
modified = "π"
staged = '[++\($count\)](green)'
renamed = "π
"
deleted = "π"
[username]
style_user = "white"
format = "[$user]($style) "
show_always = falsenano ~/.nanorc- Add the following content which references the installed version config from homebrew:
include "/opt/homebrew/Cellar/nano/*/share/nano/*.nanorc"
-
nano ~/.zshrc# aliases alias l="git status" alias jn="jupyter notebook" alias jl="jupyter lab" # autocomplete and syntax highlighting source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh autoload -Uz compinit && compinit source /opt/homebrew/Cellar/zsh-syntax-highlighting/*/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # starship eval "$(starship init zsh)"
git config --global core.editor nanogit config --global user.name "Tomas Beuzen"git config --global user.email <email-address>- Make global gitignore:
nano ~/.gitignore_globaland add the following:
.DS_Store
.ipynb_checkpoints
.Trashes
.RHistory
__pycache__
~$*
~*
*~
.~
*.egg-info
.nbgrader.log
.coverage
.vscode
- Apply with:
git config --global core.excludesfile '~/.gitignore_global'
- Install the following extensions from the marketplace:
- Python
- Better TOML
- GitHub Theme
- Material Icon Theme
- Markdown All In One
- Bracket Pair Colorizer 2
- Python Docstring Generator
- reStructuredText
- markdownlint
- Add the following user settings:
{
"workbench.colorTheme": "GitHub Dark",
"workbench.iconTheme": "material-icon-theme",
"workbench.settings.useSplitJSON": true,
"autoDocstring.docstringFormat": "numpy",
"editor.formatOnSave": true,
"python.formatting.provider": "black",
"python.linting.lintOnSave": true,
"python.linting.flake8Enabled": true,
"editor.fontLigatures": false,
"python.linting.pylintEnabled": false,
"python.linting.flake8Args": [
"--max-line-length=88",
"--ignore=E203"
],
"workbench.editorAssociations": [
{
"viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb"
}
],
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
"launch": {
"configurations": [],
"compounds": []
},
"python.defaultInterpreterPath": "/opt/homebrew/Caskroom/miniforge/base/bin/python",
"terminal.integrated.inheritEnv": false,
"workbench.settings.editor": "json",
"jupyter.alwaysTrustNotebooks": true,
"editor.wordWrap": "on",
}