curl https://raw.githubusercontent.com/MikeMcQuaid/strap/master/bin/strap.sh > strap.sh
strap.sh script, e.g. using vim, uncomment and fill up the following environment variables:
# STRAP_GIT_NAME= # STRAP_GIT_EMAIL= # STRAP_GITHUB_USER= # STRAP_GITHUB_TOKEN= # CUSTOM_HOMEBREW_TAP= # CUSTOM_BREW_COMMAND=
STRAP_GIT_EMAILis for git
user.email, and contact info on login screen.
STRAP_GITHUB_USERis to for git
github.userand accessing your
STRAP_GITHUB_TOKENis needed to allow homebrew to reduce the rate limit of
brew searchcommand and to tap your private repositories (the token can be generated at GitHub > Settings > Developer settings > Personal access tokens, with scope
CUSTOM_BREW_COMMANDare optional, to add your personal homebrew tap and custom brew command which will be run at the end of the bootstrap.
strap.sh can be automatically generated at https://macos-strap.herokuapp.com/,
which asks for your authorization on GitHub.
But I prefer to edit the script manually.
strap is idempotent, so you can run it first, adding custom dotfiles and brewfile repositories later, then run it again.
In System Preference > Keyboard > Modifier Keys,
Command keys can be swapped.
However, under the terminal I'd like to use the classical ctrl prefixed shortcuts, thus I swapped them back again.
iTerm2 is a terminal emulator with this option.
I also installed AltTab to switch applications with
Unselect "Scroll direction: Natural" in System Preferences > Mouse. (The direction may be natural to touch screen, but it is not natural for mouse at all.)
Select "Tap to click" in System Preferences > Trackpad.
Control+Shift+Power to turn off and lock screen.
Alternatively, you can put the
Screen Lock icon on touch bar (System Preference > Keyboard > Touch Bar) or configures hot corners.
When the power adapter is connected:
Long press the restore button, then select tiling in drop-down menu.
Another way is activating mission control. Then move one window to another full screen window in another virtual desktop.
Drag the edge between two tiling windows to adjust the size of the two windows at the same time.
Ctrl-Left/Right to switch among virtual desktops.
Ctrl-Up/Down to show an overview of desktops or go back to normal mode.
~/Library is hidden.
To reveal it in Finder temporarily,
hold the Option key, then click the
and the Library folder is revealed in the dropdown menu.
To permanently reveal the Library folder in Finder, run the following command:
chflags nohidden ~/Library/
BTW, most applications' user configuration files are in
To enable developer tools, select "Show Develop menu in menu bar" in Safari > Preferences > Advanced. You can also change the default encoding to UTF-8.
There are several vi shortcuts extensions for safari, for example, sVim.
sVim can be configured via sVimrc via the extension settings in Safari.
D to close and undo close tab:
" Shortcuts map "d" quit map "shift+d" lastClosedTab
Google accounts can be added to the Mail.app. Except for the gmail, other osx applications can also sync with Google account:
I use the built-in Double Pinyin Input Method.
The built-in input method uses Caps to switch between English and Chinese mode,
which makes sense to me.
I also use Caps to switch between English and Chinese mode under Linux
(the trick is to
clear lock and bind Caps to another unused key, e.g.
Multi_key, then configure it as the switch key in fcitx).