This is how I set up Mac OS for development.
Summary
- Mac OS defaults.
- Manually remap Caps Lock to Control, for each keyboard!
- Manually enable Control with Accessibility + Zoom + Scroll to zoom in
- Enable tap to click on touch pad
- Other customizations in this file: e.g. key repeat rate
xcode-select --installto install compilation tools- Uninstall
Garage Band,Pagesetc. on a work machine where they won't be used - Make the bottom dock useful - remove all the content creation apps that aren't used
- Vim 9.x (mac version) with native packages install
- Vim: Attempted coc LSP and removed: https://github.com/neoclide/coc.nvim
- https://github.com/itchyny/lightline.vim
mkdir -p ~/.vim/pack/plugins/start/ cd ~/.vim/pack/plugins/start/ git clone git@github.com:tpope/vim-rails.git git clone git@github.com:junegunn/fzf.vim.git git clone git@github.com:tpope/vim-fugitive.git git clone git@github.com:vim-ruby/vim-ruby.git git clone git@github.com:tomtom/tcomment_vim.git git clone git@github.com:NLKNguyen/papercolor-theme.git git clone git@github.com:preservim/nerdtree.git
- iTerm
- tmux
- Fish shell
- https://stackoverflow.com/a/70203456/126688
- https://github.com/oh-my-fish/oh-my-fish
- PostgreSQL installed as Postgres.app
- Git
- Global Git aliases/config in
gitconfig - Global Git ignore in
gitignore - Fuzzy Finder https://github.com/junegunn/fzf
- https://dev.to/iggredible/how-to-search-faster-in-vim-with-fzf-vim-36ko
- ripgrep (rg)
- Formatting SQL using
pg_format(brew install pgformatter) from Vim: https://www.endpointdev.com/blog/2022/04/formatting-sql-vim-pgformat/, make selection, then:!pg_format
Installation
Make sure ENV['HOME'] points at the home directory.
Clone this directory and run one or more installation Rake tasks
$ rake -T rake dotfiles # install the dotfiles into home directory rake macos_defaults # replace OS X defaults
Or to run all:
rake install
Fonts
- 11 Best Programming Fonts
- I'm trying out
Hack
- Using JetBrains Mono
Release notes
2025-08-07 New things: Neovim, init.lua, equivalent plugins exploring, mapping keyboard shortcuts, GhosTTY, mise, direnv
- Copy and paste in terminal, Neovim, OS clipboard
2025-02-13 Updates 2021-11-01 Added Fonts
2021-10-20 Overhaul of setup for 2021 development on a Mac. Introduction of new things: GH CLI, Fish shell Removed: ctrl-p, ctrl-p funky, tagbar, mustache templating, goyo vim, ack vim
2017-03-24
:PluginUpdate was run to update all plugins. Should convert this setup to native plugin management soon.
2015-04-28
Switch from git bash completion script to a homebrew version
2016-03-01
Link homebrew openssl explicitly on El Capitan OS X, before installing the eventmachine 1.0.5 eventmachine/eventmachine#602
Puma 2.9.1 (specify opt-dir or can configure bundler)
puma/puma#783
gem install puma -v '2.9.1' -- --with-opt-dir=/usr/local/opt/openssl
Homebrew
# critcal
ripgrep
git
bash-completion
tmux
universal-ctags # instead of ctags?
tldr
gh
fzf
macvim
pg_format
# less critical
jrnl
glow
gpg
redis
reattach-to-user-namespace # not sure this is still needed (2025)
rbenv
nvm
nginx
python
wkhtmltopdf
wget
proctools
fortune
htop
watch
gcal
dos2unix
jq
mplayer
tree
markdown
tig
hg
ranger
ngrok
httpie
pgcli
ical-buddy
readline
pyenv # manage python version
wrk # load testing, use wrk2
pssh # parallel ssh
lnav # log file viewer
brew tap heroku/brew && brew install heroku
# cask
brew tap homebrew/cask-versions
brew update
brew tap caskroom/cask
# cask Mac OS apps
install --cask rectangle
install --cask iterm2
install --cask macdown # Mac OS Markdown editor
install --cask dropbox
install --cask lyricsx
brew install --cask lunar # adjust brightness of LG display
brew install --cask sourcetree
Extras
OS X
- Remap caps lock to control
| Command | Description |
|---|---|
| softwareupdate --list | find available things to install |
| softwareupdate --install | update the software you named |
| ctrl-arrow key | ctrl-arrow key |
| command-alt-h | hide other applications' windows, alt is fn+opt |
vim
Interesting help:
:help opening-window
| Command | Description |
|---|---|
| :Tags | Open tags with FZF |
| de | delete to the end of the current word, INCLUDING the last character |
| ce | change until the end of word |
| 2dd | delete 2 lines |
| % | place cursor on character like ( and press % to find match |
| "_d | black hole register, e.g. "_dw to delete a word without storing the result in a register |
| Ctrl-e | execute vim-sparkup |
| gf | jump to code under cursor, rails.vim adds more |
| jj | insert mode to normal mode |
| jjj | insert mode to normal mode and write buffer |
| Ctrl-n | on top of a word, enable multiple cursors match |
| Ctrl-p | next match with multiple cursors, ctrl-x to skip a match |
| Ctrl-c | in normal mode, writes to ~/.vimbuffer (copy and paste between instances) |
| Ctrl-v v | paste from ~/.vimbuffer |
| Ctrl-p | normal mode, CtrlP find |
| Ctrl-b | CtrlP MRU buffer list |
| Ctrl-f | CtrlP function matching |
| Ctrl-h/j/k/l | navigate between panes |
| Ctrl-^ | last buffer |
| leader-n | show file in nerdtree |
| Ctrl-p | insert mode, displays autocomplete suggestions |
| s | in nerdtree, "s" on a file opens it in a vertical split |
| i | in nerdtree, "i" opens in split |
| :A | rails.vim, open alternative file |
| :Rcontroller | rails.vim, open related controller |
| :Rails console | rails.vim, open a console |
| :Rlog | rails.vim, open rails log file in a split window |
| :ctags -R ! | generate tags file for project |
| leader-c | call ctags on project |
| Ctrl-] | navigate via tags to item under cursor |
| Ctrl-t | navigate back after jumping with ctags |
| :AV | rails.vim, edit the alternate file in a vertical split |
| dap | delete around paragraph |
| :ta | navigate list of tags |
| "*y | copy to OS X clipboard |
| Ctrl-v | in ctrlp buffer list, open buffer in vertical split |
| Ctrl-x | in ctrlp buffer list, open buffer in split |
| leader-w | write buffer |
| leader-q | quit buffer |
| ^ | jump to first character of line |
| leader-s | toggle spellchecking |
| Ctrl-w | toggle panes |
| gU | make uppercase, plus motion (w, k etc.) |
| ~ | swap case |
| Ctrl-o | jump back |
| Ctrl-i | jump forward |
| nG | jump to line n |
| Ctrl-u | in insert mode, delete line before cursor |
| Ctrl-w | in insert mode, delete word before cursor |
| Ctrl-w H/J/K/L | re-configure split panes, cycle the splits layout |
| leader-p F5 | refresh ctrlp buffer list |
| :30winc > | add 30 characters of width to vertical split |
| v | with ack.vim, browsing results, "v" to open result in vertical split |
| Ctrl-w _ | maximize a pane vertically |
| Ctrl-w | |
| Ctrl-w = | make the pane sizes equal |
| ctrl-w = | resize all panes |
| leader-t | with vimux and turbux, run test in tmux pane |
| leader-T | run focused unit test in tmux pane with vimux and turbux |
| :vs | open the last buffer in a vertical split |
| - | first non-blank character previous line |
| _ | first non-blank character current line |
| Ctrl-w r | rotate/swap/cycle/switch split panes |
| daw | delete around word |
| fx | jump to first x, ; char repeats motion |
| i and a | text objects, select inside, or select everything including delimiter, e.g. cit |
| is | inside sentence |
| ip | inside paragraph |
| t{char} | before the char, f{char} puts cursor on the char |
| mm | set a mark, with char m, m{a-zA-Z} |
| `m | jump to mark m |
| `. | last change |
| g; | similar to `., can be repeated |
| `< | and `> start and end of last visual selection |
| dd | cut the current line, ddp to transpose current next lines |
| yyp | yank yank paste, duplicates line |
| Ctrl-r{register} | e.g. Ctrl-r" or C-r0 |
| "+p | put from the Plus register, to avoid toggling paste option |
| C-\s | on top of a method, cscope query, to find caller of a method |
| :so ~/.vimrc | reload the ~/.vimrc |
| visual selection + S (capital "s") | type HTML tag like to surround visual selection in tag, depends on surround.vim |
| ctrl-r " | paste from insert mode |
| d/ | hit enter after typing the selection, delete until the selection |
| f [space] | ";" will repeat the motion |
| pry [tab] | in a ruby file, will insert a pry binding statement, part of the built-in ruby snippets file |
| y$ | yank until the end of the line without the newline |
| gui | switch to GUI |
| redraw! | redraw the screen when it goes black http://stackoverflow.com/a/1117742/126688 |
| e %:h (tab) | expands current directory. supply filename to create a new file at that point on disk. |
| cc | delete entire line and enter insert mode |
| ciB | change inner block (inside of {} braces) |
| comment out | ctrl-slash-slash |
| pgrep -f | -f is to match against full argument list, typically need this for a backgrounded rails console process name |
| ctrl-o-o | open last location https://dev.to/jovica/3-little-known-but-useful-vim-tips-1pbg |
bash
| Command | Description |
|---|---|
| ctrl-l | clear line |
| Ctrl-u | cut line |
| ctrl-y | paste line |
| Ctrl-y | restore before delete |
| Ctrl-a | move cursor, front of line |
| Ctrl-e | move cursor, end of line |
| Esc-b | move cursor, back one word |
| Esc-f | move cursor, forward one word |
| Ctrl-w | delete one word |
| option-b | back one word (OS X?) |
| option-f | forward one word (OS X?) |
| jobs | list jobs |
| jobs -p | list backgrounded jobs process IDs |
| fg 1 | bring background job 1 to the foreground |
| Ctrl-x Ctrl-e | edit command line command in $EDITOR |
| less +F path/to/log | "follow" the log file, ctrl-c to go in to search mode, "F" to return to following |
Google Chrome
Workflow goal: avoid opening duplicate tabs:
- Start typing a URL, use "Switch to this tab" when there is a match
cmd-shift-aopen up the built-in tab search, if google calendar is already open, use that tab- Chrome keyboard shortcuts
- Vimium plugin
cmd-option-i # toggle web inspector option-command-u # open page source cmd-shift-a # Search open tabs!
iTerm2
- Use Source Code Pro font (replaced with JetBrains Mono)
- Profile > Keys > Left option key acts as "+Esc"
Cmd-/ # show cursor Cmd-shift-d # split the window horizontally Cmd-option-arrow # move between the split panes
tmux
Tmux cheat sheet. I use a leader of Ctrl b. I also use screen which uses ctrl a.
| Command | Description |
|---|---|
| leader + w | preview sessions, especially helpful for unnamed sessions |
| tmux new-session -s dev_logs | start a new session named dev_logs |
| tmux attach-session -t 0 | attach to session 0 |
| leader + h | terminate a stuck SSH session |
| leader + $ | rename a session |
| leader + :kill-pane | kill a stuck pane |
Or rename session from terminal:
- tmux rename-session [-t current-name] [new-name]
| leader + c | new window | | leader + , | rename a window | | leader + space | switch to next pane layout |
Reload configuration: tmux source ~/.tmux.conf
leader + I (capital "I") to install plugins
When messed up (e.g. lost mouse scrolling), try these:
tmux refresh-client -Sreset
tmux set -g mouse off tmux set -g mouse on
Or try detach (ctrl-b d) and re-attach
- Save:
prefix + Ctrl-s - Restore:
prefix + Ctrl-r
Swap pane with next one:
Ctrl-b }
screen
screen -S session_name ctrl-a d # detach screen -ls # list sessions screen -r <session> # re-attach to session screen -XS <session> quit
Vim snippets
Snippets directory ~/.vim/bundle/vim-snippets/snippets
=<tab> # puts in Erb expression tags (requires snipmate) %<tab> # puts in Erb expression tags (requires snipmate) def<tab> # start a ruby method div # can use this for markup too
tig
git log | tig git diff master | tig h # help m # toggle main view (useful to jump back and forth between code details and commit titles)
jrnl
- Default config file:
~/.config/jrnl/jrnl.yaml - Configure editor in the config file
jrnl # enter compose mode jrnl @tag # list entries that include tag jrnl -n10 # list last 10 entries jrnl --edit # edit old entries (unencrypted file)
spectacle
option-command-right arrow # right half option-command-f # full screen
Slack
+:... # plus sign plus "colon" to pull up Emoji reactions, will react to most recent post up arrow key # edit last message Command-t # jump to another channel Command-1/2/3... # Jump to multiple workspaces in OS X desktop client app option-arrow up/down # move up/down between channels command-left/right bracket # move between channels /remind # create a reminder, type date and time naturally /leave # leave a channel / # find out more slash options available `` # or triple backticks code fence
Microsoft Teams
Keyboard Shortcuts for MS Teams
I use it on Mac OS but swap "command" for "control" on Windows.
command-shift-x # put focus on new message command-enter # send message command-e # search bar on top command-shift-m # mute/unmute microphone command-shift-o # toggle video on/off command-1/2/3 # navigate vertically between activity/chat/teams sections option-arrow up/down # navigate items vertically under org
Xcode and simulator
command-shift-o # fuzzy find files by name (open quickly), colon line number (e.g. ":42" to open line 42) command-b # build command-1 # etc. to resize the simulator ctrl-command-left/right # move back and forth between windows command-click # jump to method definition ctrl-command-up # switch between header and implementation file command-shift-j # show file in project navigator
Httpie
tldr httpie(or just usecurl)
showterm
Terminal screencasting!
showterm [command]
lnav
Fancy log file viewer with cool features: http://lnav.org/features/
brew install lnav lnav path/to/log ? # help
Sidekiq.redis { |conn| conn.flushdb }
redis-cli flushdb # dump everything in redisIntelliJ OS X
IdeaVim action list: https://gist.github.com/zchee/9c78f91cc5ad771c1f5d
command-shift-t # jump to corresponding test command-shift-a # action or option name command-shift-a, type "select in project view" # view file in project view command-shift-o # Enter file name command-[ or command-] # jump backward and forward in history :action Run # run the current file :action "Split Vertically" # vertical split <C-W> + h/j/k/l # move between splits Ctrl + ww # switch between windows command-shift-c # copy current filepath to clipboard command+F12 # file structure popup command+e # view recent files ctrl-space # basic code completion ctrl-shift-space # smart code completion command-1 # show/hide project view open -a "IntelliJ IDEA" # open application when running Docker
Plugin: Key Promoter
VS Code
- Marp for VS Code
Shift-command-Vopens preview but in same windowCommand-K + Vopens side by side markdown preview for.mdfile- Column selection:
shift-option+ mouse - Format SQL queries: SQL Tools https://stackoverflow.com/a/66873825
Zoom
command-shift-a # toggle audio command-shift-v # toggle video
Man pages
tldr as an improvement or supplement to man, with examples, e.g. tldr curl
Maven
mvn -Dtest=com.andy.AwesomeTest test # run specific test mvn clean compile exec:java # compile & boot app
Go lang
gore # Go lang REPLHomebrew
brew listbrew cask list# OS Xbrew deps --tree --installed
pyenv
pyenv versions
Windows
- Windows Terminal.
iTermlike.Ctrl-Tabto switch between tabs. - Use WSL 2. Requires a newer Windows build. This link helps debug Windows Update problems via log files and clears a cache. https://www.howtogeek.com/416169/how-to-fix-what-needs-your-attention-windows-10-setup-errors/
- My preference: Remap Caps to Ctrl. This can be done with Keyboard Manager in PowerToys.
- Currently using Ubuntu 18.04 with WSL 2
- Use
wslcommands--set-versionto convert an existing distribution or--set-default-versionfor all new distributions - Chrome with Vimium, AdBlock, 1Password
MacDown
Markdown editor for OS X. Workaround for being a unidentified developer: https://macdown.uranusjr.com/faq/#unidentified
GitHub CLI
gh pr create [flags]gh browse -b (git branch --show-current)
GitHub
TCommand-K
Fish shell
Ctrl-f- complete a suggestionfish_configto launch the web based configurationomf install boxfishcdhplus letter or number, ordirh- list directory history- With background
jobs, usefg %1to foreground job 1
Fuzzy Finder
vim (fzf)history | fzf:Rgwithin Vim to search within files:Buffers
ripgrep
https://mariusschulz.com/blog/fast-searching-with-ripgrep
rg TODO app/modelssearch the models directoryrg --files-with-matches TODO app/models/# only files, or-lrg --files-with-matches TODO app/models/ --sort path
Rectangle
https://github.com/rxhanson/Rectangle
glow
Command line Markdown!
Set a config file to set a pager and other stuff
glow --config- Edit that file with:
# show local files only; no network (TUI-mode only)
local: true
# mouse support (TUI-mode only)
mouse: true
# use pager to display markdown
pager: true
# word-wrap at width
width: 80
asdf
A version manager for lots of things
SSH
Manually set /etc/ssh/ssh_config, this is not automatically installed
Microphone
osascript -e "set volume input volume 95"jq / JSON
Viewing JSON in Vim:
:% !jq .
Shottr
Screenshots! https://shottr.cc
Neovim
Macvim plugins guide:
- git clone git@github.com:tpope/vim-rails.git
- git clone git@github.com:junegunn/fzf.vim.git (plus
brew install fzf) - git clone git@github.com:tpope/vim-fugitive.git
- git clone git@github.com:vim-ruby/vim-ruby.git
- Works, or can switch to native Lua
mini.commentgit clone git@github.com:tomtom/tcomment_vim.git - git clone git@github.com:NLKNguyen/papercolor-theme.git
- Same, or switch to nvim-tree.lua, git clone git@github.com:preservim/nerdtree.git