Mac Reinstallation Note


1. Mac Reinstall (document)

(1) Restart Mac and press Shift + Option + Cmd + R.
Install the macOS that came with your Mac, or the version closest to it that is still available.

(2) Use Dick Utility to erase the disk.

Complete the fields:

  • Name: Macintosh HD
  • Format: Mac OS Extended (Journaled) (Don’t choose APFS)
  • Scheme (if available): GUID Partition Map

Note: If I choose APFS as the format, it would always fails to reinstall the macOS. So, I recommand to use Mac OS Extended (Journaled) instead.

(3) Reinstall macOS

2. iTerm2 (download)

(1) Reuse Session’s Directory

(2) Color Theme: Tango Dark

3. .bash_profile

~/.bash_profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# enables color in the terminal bash shell
export CLICOLOR=1

# sets up the color scheme for list
export LSCOLORS=ExFxCxDxBxegedabagacad

# enables color for iTerm
export TERM=xterm-color
export TERM="xterm-color"
PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '

# sets up proper alias commands when called
alias ls='ls -vG'
alias ll='ls -al'
alias la='ls -a'
alias vi='vim'
alias ptt='ssh bbsu@ptt.cc'

# mkdir + cd
function mkcd {
if [ ! -n "$1" ]; then
echo "Enter a directory name"
elif [ -d $1 ]; then
echo "\`$1' already exists"
else
mkdir $1 && cd $1
fi
}

# [macOS] Show/Hide the hidden files in Finder.
# add this function to '~/.bash_profile' and reopen terminal.
# Usage: show-file -> show
# show-file 0 / off / hide / false -> hide
function show-file () {
opt=$(echo $1 | tr '[:upper:]' '[:lower:]') # transfer into lowercase

# Hide Files
if [ "$opt" = "off" ] || [ "$opt" = "0" ] || [ "$opt" = "false" ] || [ "$opt" = "hide" ] ; then
echo "Hide all the hidden files in Finder."
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
return
fi

# Show all the Files
echo "Show all the hidden files in Finder."
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
echo "Use 'show-file off' to hide the hidden files in Finder."
}

4. vim

Download color theme Gruvbox to ~/.vim/colors/gruvbox.vim and edit ~/.vimrc:

~/.vimrc
1
2
3
syntax on
set t_Co=256
colorscheme gruvbox

5. BetterTouchTool (download)

(1) launch BetterTouchTool on startup

(2) Window Snapping

(3) Three Finger Tap = Mouse Middle Click

(4) Setup shortcut

6. Trackpad



7. Enable Dragging



8. Enable Function Key for F1 ~ F12

9. Karabiner-Element (download)

(1) Swap left_control and left_command (Simple Modification)

(2) Backslash to Forward Delete [Click to Import] (Complex Modification)


10. Alfred 2 (download)

Title Keyword Search URL
Messenger msg https://www.messenger.com/
Yahoo Dictionary y https://tw.dictionary.yahoo.com/dictionary?p={query}
Google Maps m
Translate f
Gmail g
Youtube you
Facebook fb

11. Sublime Text 3 (download)

(1) Enable Sublime Text Command Line

1
2
mkdir ~/bin
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
~/.bash_profile
1
2
# export ~/bin
export PATH=~/bin:$PATH

(2) Enable Sublime Package Control

Use Ctrl + ` to open the console and paste the code in it.

(3) Install Packages

  • HTML-CSS-JS Prettify
  • Babel
  • MarkdownLight
  • GitGutter

Use Cmd + Shift + P to search package control.

Search the name of packages.

(4) Preferences.sublime-setting (use Cmd + , to open preference)

1
2
3
4
5
6
7
8
{
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"auto_complete_selector": "source, text",
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules"]
}

12. Brew

1
2
# install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Note: git will be installed during the installation.

13. Node.js, NVM (Node Package Manager)

1
2
3
4
5
6
7
8
9
10
11
12
# install nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

# install node via nvm
nvm ls-remote --lts
nvm install --lts

# update npm (Node Package Manager)
npm install -g npm

# download yarn via brew (alternative of npm)
brew install yarn --without-node

14. Git

1
2
# install git via brew
brew install git

(1) Git config and alias

1
2
3
4
5
6
7
8
9
10
11
# config
git config --global color.ui true
git config --global core.editor vim
git config --global core.quotepath false

# git alias
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.cp cherry-pick
git config --global alias.st stash
git config --global alias.sub submodule

(2) git-completion

1
2
# Download git-completion.bash
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash > ~/.git-completion.sh
~/.bash_profile
1
2
# git bash completion
[ -f ~/.git-completion.sh ] && . ~/.git-completion.sh

(3) diff-so-fancy

1
2
3
4
5
# install diff-so-fancy via yarn
yarn global add diff-so-fancy

# use diff-so-fancy to diff code
git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"

15. Audacity ([download]](http://www.audacityteam.org/download/mac/))

(1) Install LAME 3.99.5 for Audacity download
(2) Set shortcut cmd + shift + E for Export Selected Audio ...

16. Other Apps (13)

Reference

Share Comments