Skip to content

Instantly share code, notes, and snippets.

@maco
Last active May 10, 2023 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maco/6c8a6f74611c7108101f10efbb04914b to your computer and use it in GitHub Desktop.
Save maco/6c8a6f74611c7108101f10efbb04914b to your computer and use it in GitHub Desktop.
How to set up my mac

Clicky stuff

OS preferences

  1. Enable tap to click
  2. Set wallpaper and screensaver to use my good photos

1Password

  1. Appearances > Always show in the sidebar > Categories
  2. Security > Concealed Fields > Hold Option to toggle revealed fields
  3. Set up CLI
  4. Add CLI to fish completions op completion fish | source

Alfred

  1. Disable spotlight's shortcut (Settings > Keyboard > Keyboard shortcuts > Spotlight) so it can be used for Alfred
  2. Set theme to "Alfred Dark"
  3. Setup emoji expansion (Features > Snippets > Get Collections)
  • when you click the downloaded file, it'll offer to import)
  • ✅ Atomatically expand snippets by keyword

Airdropping ~/Library/Application Support/Alfred/Alfred.alfredpreferences (Cmd+Shift+. to view hidden files) and then cp -R ~/Downloads/Alfred.alfrepreferences ~/Librar/Application\ Support/Alfred/ will do some of this

Anki

Click "Sync" to configure syncing settings. It's not in the settings.

TexMaker

LuaLaTeX is super flexible about fonts and colors and stuff

Typey stuff

Shell

Accept XCode license: sudo xcodebuild -license accept

Install stuff

Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

From Homebrew:

brew install coreutils curl git gh gnupg fish starship asdf tree direnv awscli awslogs httpie kubernetes-cli openssl pre-commit yarn tldr jq texlive
brew install --cask 1password/tap/1password-cli

Fisher, a plugin manager for Fish

Configure GitHub

Authenticate with Github: gh auth login

Configure iTerm

Grab profile JSON and import that.

gh gist clone aa77dce9a762e8a07dbd6ae86f94631d

The fish path needs to be /usr/local/bin/fish on Intel and /opt/homebrew/bin/fish on ARM.

Download Monokai Remastered terminal colors and import at Profiles -> Colors,

In iTerm2 preferences, set Profiles > General > Command > Custom Shell /opt/homebrew/bin/fish

(The new Fish profile probably won't work right until Fish is actually configured, so don't set it as default until then.)

Configure Fish

Ensure everything installed via Homebrew works: fish_add_path /opt/homebrew/bin

Get Kubernetes autocompletion, with fisher install evanlucas/fish-kubectl-completions

In ~/.config/fish/config.fish put:

source (brew --prefix asdf)/asdf.fish
starship init fish | source

set fish_greeting

function fish_title
    set -q argv[1]; or set argv fish
    # Looks like ~/d/fish: git log
    # or /e/apt: fish
    echo (fish_prompt_pwd_dir_length=1 prompt_pwd): $argv;
end

set -x VISUAL /usr/bin/vim
set -x EDITOR /usr/bin/vim
set -x ERL_AFLAGS "-kernel shell_history enabled"

alias iso8601='date +%Y-%m-%dT%H:%M:%S%z'

function s3_make_public -d "makes a file on s3 public" -a BUCKET FILEPATH
  command aws s3api put-object-acl --bucket $BUCKET --key $FILEPATH --acl public-read
end

function revert_back_to -d "makes a commit that reverts multiple merge commits" -a MAIN_BRANCH REVISION NEW_BRANCH
  # https://stackoverflow.com/questions/60766114/how-to-revert-multiple-pull-request-merges-all-at-once-and-preserve-history
  git checkout $MAIN_BRANCH
  git checkout $NEW_BRANCH $REVISION
  git reset --soft MAIN_BRANCH
  git commit -m "Reverting"
  git branch -f $MAIN_BRANCH
  git checkout $MAIN_BRANCH
end

# keep last
eval (direnv hook fish)

Open a new iTerm2 shell to get the new environment.

Installing more tools with asdf

NodeJS

Get the NodeJS keyring bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-release-team-keyring'

Postgres

It'll probably have DB named postgres and a user with my username and no password. To add another user, run something like: CREATE ROLE postgres WITH SUPERUSER LOGIN PASSWORD 'postgres';

Elixir

Don't forget to install hex: mix local.hex

Git

Set up a ~/.gitconfig

[user]
	name = my name
	email = me@example.com
[init]
	defaultBranch = main
[rerere]
	enabled = true
[alias]
	pu = !git push origin `git branch --show-current`
	rename = branch -m
	uncommit = reset --soft HEAD^
	br = checkout -b
	tree = log --graph --decorate --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true

Set up an SSH key: ssh-keygen -t rsa -b 4096 -C "me@example.com" and add it to GitHub

Mobile Dev

Install a Python using asdf. Check with coworkers on locally-preferred version (if working in a Python shop) and make it default:

asdf plugin add python
asdf install python 3.6.6
cat "python 3.6.6" >> ~/.tool-versions

Install IDB:

brew tap facebook/fb
idb-companion
pip3 install fb-idb
asdf reshim python

Install Flipper: https://fbflipper.com/

In the Flipper preferences, set:

  • Android SDK: Users/<me>/Library/Android/sdk
  • IDB location: /Users/<me>/.asdf/shims/idb

If Flipper shows errors about a FileNotFound, then tweak the ~/.asdf/installs/python/3.6.6/lib/python3.6/site-packages/idb/client/grpc.py file. Find where it has the CompanionSpawner and change the companion_path to /usr/local/Celler/idb-companion/<version>/bin/idb_companion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment