Mac Setup Distilled
Starting from a clean install
From your terminal
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Note: brew needs Xcode Command Line Tools to be compiled so you may see the following request:
==> The Xcode Command Line Tools will be installed.
Press RETURN to continue or any other key to abort
From your terminal
brew install node
brew install git
brew install postgres
brew install mongo
Setup git username and email address
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
The credential helper tells Git to remember your GitHub username and password. If you installed Git using Brew then the credential helper is already installed installed.
git config --global credential.helper osxkeychain
Now you can use HTTPS for git instead of SSH.
Install common global NPM packages
npm install -g eslint mocha http-server nodemon
ESLint supports both global and local configurations so you can have eslintrc files in individual projects as well as at user root. The child configurations in the project folder take precedence over higher configurations. In your user root create the following file.
cd ~
eslintrc.json
/**
* ESLint: http://eslint.org/docs/user-guide/configuring
*/
{
// https://eslint.org/docs/user-guide/configuring#specifying-parser
"parserOptions": {
"ecmaVersion": 7 //same as 2016
},
// https://eslint.org/docs/user-guide/configuring#specifying-environments
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true,
"jest": true,
"mongo": true,
"jquery": true
},
// our configuration extends the recommended base configuration
// https://eslint.org/docs/user-guide/configuring#extending-configuration-files
"extends": "eslint:recommended",
// https://eslint.org/docs/rules/
// ESLint rules: Severity Levels: off = 0 | warn = 1 | error = 2
"rules": {
"strict": ["error", "safe"], //prefer `'use-strict';` pragma
"eqeqeq": [2, "allow-null"],
"no-console": "off", //ignores `console.log()`
"no-unused-vars": ["warn", { "vars": "local", "args": "after-used", "ignoreRestSiblings": false }],
"no-eval": "error", //disallows `eval()` usage
"quotes": [2, "single", "avoid-escape"], //prefer single quotes over double quotes
"indent": ["error", 2, { // enforce 2 space indents (not tabs)
"SwitchCase": 1 // clauses with 2 spaces with respect to switch statements
}],
"semi": ["error", "always"] //enforce semi-colon usage
}
}
Set the default PostgreSQL PGDATA directory
~/.bash_profile
filetouch ~/.bash_profile
echo 'export PGDATA=/usr/local/var/postgres' >> ~/.bash_profile
App Store Apps:
Other Apps
Git uses both local and global gitignore files. You can setup a global gitignore which will prevent common files from accidentally being committed to your repos.
cd ~
.gitignore
######################
# REF: https://gist.github.com/octocat/9257657
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
# *.sql This should be committed for demos
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
If you installed the above apps using brew, then you can setup command line completion for git, npm, brew,
#####
# (OPTIONAL) COMMAND LINE COMPLETION
# http://superuser.com/questions/31744/how-to-get-git-completion-bash-to-work-on-mac-os-x
#####
# Load bash completion for brew
if [ -f `brew --prefix`/etc/bash_completion.d/brew ]; then
source `brew --prefix`/etc/bash_completion.d/brew
fi
# Load bash completion for git
if [ -f `brew --prefix`/etc/bash_completion.d/git-completion.bash ]; then
source `brew --prefix`/etc/bash_completion.d/git-completion.bash
fi
# Load bash completion for NPM
if [ -f `brew --prefix`/etc/bash_completion.d/npm ]; then
source `brew --prefix`/etc/bash_completion.d/npm
fi
Optionally, you can setup your prompt to show your git repository status
#####
# (OPTIONAL) GIT PROMPT SUPPORT
# View the git-prompt.sh file for mor information
#####
# Load git prompt
if [ -f `brew --prefix`/etc/bash_completion.d/git-prompt.sh ]; then
source `brew --prefix`/etc/bash_completion.d/git-prompt.sh
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
fi
Now you command prompt will looks something like this:
[user@MACHINE git-repository-name (master)]$
Open Terminal App and open preferences
Disable swipe to go back
defaults write com.google.Chrome.plist AppleEnableSwipeNavigateWithScrolls -bool FALSE
defaults write com.apple.finder AppleShowAllFiles YES
To hide them again, run
... AppleShowAllFiles NO
defaults write com.apple.dock autohide-delay -int 5; killall Dock;
defaults write com.apple.dock autohide-delay -int 0;
defaults write com.apple.dock autohide-time-modifier -int 0;
killall Dock;
defaults delete com.apple.dock autohide-delay;
defaults delete com.apple.dock autohide-time-modifier;
killall Dock;