Last active
December 5, 2019 21:51
-
-
Save radeksimko/8545055cfd27e859844a to your computer and use it in GitHub Desktop.
New MacOS bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export GOPATH=$HOME/gopath | |
# Path | |
export PATH=/opt/local/bin:/usr/local/bin:/opt/local/sbin:/usr/local/sbin:$PATH | |
export PATH=/usr/local/share/npm/bin:$PATH # NPM | |
export PATH=/usr/local/mysql/bin:$PATH # MySQL | |
export PATH=/usr/local/pear/bin:$PATH # Pear | |
export PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH # sed | |
export PATH=$GOPATH/bin:$PATH # Go | |
export MANPATH=/usr/local/opt/gnu-sed/libexec/gnuman:$MANPATH | |
# Locales | |
# export LANGUAGE=en_US.UTF-8 | |
# export LC_ALL=en_US.UTF-8 | |
# export LC_CTYPE=en_US.UTF-8 | |
export LANG=en_GB.UTF-8 | |
export LC_CTYPE="C" | |
export LC_NUMERIC="C" | |
export LC_TIME="C" | |
export LC_COLLATE="C" | |
export LC_MONETARY="C" | |
export LC_MESSAGES="C" | |
export LC_PAPER="C" | |
export LC_NAME="C" | |
export LC_ADDRESS="C" | |
export LC_TELEPHONE="C" | |
export LC_MEASUREMENT="C" | |
export LC_IDENTIFICATION="C" | |
export LC_ALL= | |
# Prompt | |
export PS1="\\u@local:\\W $ " | |
export HISTFILESIZE=5000 | |
[ -f /usr/libexec/java_home ] && export JAVA_HOME=$(/usr/libexec/java_home) | |
export HOMEBREW_CASK_OPTS="--appdir=/Applications" | |
# AWS credentials | |
[ -f ~/.aws ] && . ~/.aws | |
# Github token | |
[ -f ~/.github ] && . ~/.github | |
# Homebrew GH token | |
[ -f ~/.homebrew ] && . ~/.homebrew | |
alias guard="bundle exec guard" | |
alias rake="bundle exec rake" | |
alias chrome="open -a '/Applications/Google Chrome.app'" | |
alias editor='subl' | |
alias sed='gsed' | |
if [ -f $(brew --prefix)/etc/brew-wrap ];then | |
source $(brew --prefix)/etc/brew-wrap | |
fi | |
# Finished adapting your PATH environment variable for use with MacPorts. | |
[ -f ~/.launchctl-completion.bash ] && . ~/.launchctl-completion.bash | |
genpasswd() { | |
local l=$1 | |
[ "$l" == "" ] && l=20 | |
head -30 /dev/random | uuencode -m - | tail -3 | head -1 | sed 's/[^A-z0-9_]/Y/g' | head -c ${l} | |
echo "" | |
} | |
dgo() { | |
local DESIRED_GO_VERSION=${1:-latest} | |
local NAME=$(basename "$PWD") | |
local DOCKER_GOPATH="/_go" | |
local REL_PATH=${PWD/$GOPATH\/src\//} | |
local ABS_PATH=${PWD/$GOPATH/$DOCKER_GOPATH} | |
echo "Launching golang:${DESIRED_GO_VERSION} for ${REL_PATH} ..." | |
docker run --rm -ti --cap-add SYS_PTRACE -e GO111MODULE=on -v "$PWD":$ABS_PATH -w $ABS_PATH golang:${DESIRED_GO_VERSION} bash | |
} | |
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
source $(brew --prefix)/etc/bash_completion | |
fi | |
# GIT bash current branch | |
# by HABR (modified by Dundee) | |
export PSORIG="$PS1" | |
function GITBRANCH() { | |
branch="$(git branch 2>/dev/null | grep '*' | cut -d" " -f2-)" | |
dirty="$(git status -s 2>/dev/null)" | |
if [ -n "$dirty" ] ; then | |
color="1;33m" | |
else | |
color="0;33m" | |
fi | |
if [ -n "$branch" ] ; then | |
export PS1=$PSORIG$(echo -en "\[\033[$color\]$branch\[\033[0;33m\] > \[\033[00m\]") | |
else | |
export PS1="$PSORIG" | |
fi | |
} | |
PROMPT_COMMAND="GITBRANCH;" | |
# TODO screen detection | |
function screen_detection() { | |
if [ $TERM == 'screen' ]; then | |
export PS1="\e[1m\e[34m zzz $PSORIG\e[39m\e[21m" | |
else | |
export PS1="$PSORIG" | |
fi | |
} | |
#PROMPT_COMMAND="$PROMPT_COMMAND screen_detection;" | |
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi | |
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi | |
if which goenv > /dev/null; then eval "$(goenv init -)"; fi | |
#source '/opt/homebrew-cask/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc' | |
#source '/opt/homebrew-cask/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc' | |
export VAGRANT_DEFAULT_PROVIDER=virtualbox | |
export GPG_TTY=$(tty) | |
export GOOGLE_PROJECT=hc-radek | |
export EDITOR="subl -w" | |
export PATH="/usr/local/opt/curl/bin:$PATH" | |
export GOENV_DISABLE_GOPATH=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Radek Simko | |
email = [email protected] | |
signingkey = 4DECCD28668ED457 | |
[core] | |
editor = subl -w | |
[color] | |
branch = auto | |
diff = auto | |
interactive = auto | |
status = auto | |
ui = auto | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta bold | |
old = red bold | |
new = green bold | |
whitespace = red reverse | |
[core] | |
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
[commit] | |
gpgsign = true | |
[gpg] | |
program = gpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set hostname | |
sudo scutil --set HostName <name> | |
sudo scutil --set LocalHostName <name> | |
sudo scutil --set ComputerName <name> | |
dscacheutil -flushcache | |
# Install XCode CLI tools (e.g.git) | |
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress | |
PROD=$(softwareupdate -l | grep "\*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n') | |
softwareupdate -i "$PROD" --verbose | |
rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress | |
# Homebrew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew doctor | |
git -C "$(brew --repo homebrew/core)" fetch --unshallow | |
# iTerm | |
brew cask install iterm2 | |
# TODO: Reconfigure iTerm: | |
# - Profiles → Text → font size | |
# - Word skip (https://apple.stackexchange.com/a/293988) | |
# - Appearence → Panes → untick "Show per-pane title bar" | |
# - Profiles → Terminal → Unlimited scrollback | |
# TODO: Reconfigure Sublime Text (font size, plugins) | |
# TODO: Restore ~/.bash_profile etc. | |
# TODO: Restore ~/.homebrew (with GitHub token) | |
# TODO: Install & license Little Snitch (requires kext permission) | |
# TODO: Launch & login to 1Password (Account -> Setup other devices -> share link via AirDrop + share master key) | |
# TODO: Launch & login to Chrome | |
# TODO: Login to LastPass (2FA in Yubikey Authenticator) | |
# TODO: Launch & login to AppStore | |
# TODO: Launch & license Sublime Text | |
# TODO: Launch & login to Slack | |
# TODO: Launch & login to EncryptMe | |
# TODO: Launch & login to Zoom | |
# TODO: Launch HP Easy Start & finish installation | |
go get -u github.com/FiloSottile/captive-browser | |
# TODO: Restore linkage to GPG keys: https://github.com/radeksimko/notes/blob/master/yubikey.md#new-macbook | |
# TODO: Disable annoying managed extension | |
cd "~/Library/Application Support/Google/Chrome/Default/Extensions" | |
rm -rf ./hfokdlmjeppdmpbngjpnlnijogcecaop/* | |
sudo chown root:staff hfokdlmjeppdmpbngjpnlnijogcecaop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew cask install homebrew/cask-drivers/hp-easy-start 1password adobe-air adobe-acrobat-reader android-file-transfer blue-jeans blue-jeans-browser-plugin caffeine daisydisk docker encryptme firefox google-chrome google-cloud-sdk google-hangouts googleappengine gpg-suite iterm2 java keybase little-snitch minikube ngrok pallotron-yubiswitch opera slack spotify sublime-text the-unarchiver vagrant virtualbox viscosity vlc vmware-fusion wireshark zoomus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install ack app-engine-python autoconf automake awscli bash bash-completion bazaar bundler-completion cabextract certbot cmake consul curl envchain gcc git gnu-sed gnu-tar gnutls go graphviz htop httpie hub ipcalc jq kubernetes-cli links mas maven maven-shell mercurial mitmproxy mtr mysql-client nmap node nomad openssh openssl openssl p7zip packer pcre pcre2 perl pinentry postgresql pyenv pyenv-virtualenv python qemu ragel rake-completion rbenv rbenv-binstubs rbenv-bundle-exec rbenv-bundler rbenv-use rbenv-whatis ruby ruby-build s3cmd speedtest-cli spoof-mac sysdig terraform tree util-linux vagrant-completion vault vim watch wget xz youtube-dl | |
brew install goenv --HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mas install \ | |
441258766 # Magnet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment