Reinstalando o Macbook Pro

Eu precisei reinstalar o Macbook Pro esses dias, aproveite para anotar tudo e fazer um passo a passo. Tentei usar o Homebrew para 90% das coisas, acho que deu bom.

Mais um dump mental, assim eu limpo o HD, alivio o LOAD, e libero a mente para rodar o processo criatividade com mais recursos :)

xcode

precisamos instalar esta dependência antes de instalar o brew

xcode-select --install 

package managers

Instalando o Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Habilitando o repo Cask

brew tap caskroom/cask

Instalando o MAS (mac app software)

    brew install mas

mas apps

Xcode 11.5

mas install 497799835

CheatSheet 1.03

mas install 529456740

The Unarchiver 4.2.2

mas install 425424353 

Twitter 8.21

mas install 1482454543

Keynote 10.0

mas install 409183694 

Mactracker 7.9.2

mas install 430255202

Istat Mini 1.1

mas install 927292435 

MagicanRest 1.0.1

mas install 634255909

Pomodorable 1.0.2

mas install 503406673

Tweetbot 3.3.3

mas install 1384080005

Display Menu 2.2.3

mas install 549083868

Money 5.6.10

mas install 1185488696

SSH Tunnel Manager 2.1.4

mas install 424470626 

Disk Speed Test 3.2

mas install 425264550

Moom 3.2.17

mas install 419330170

SubnetCalc 1.5

mas install 412946682

Amphetamine 5.0.2

mas install 937984704

Speedtest 1.11

mas install 1153157709

Shazam 2.10.0

mas install 897118787

brew

most recent versions of macos tools

brew install coreutils
brew install vim
brew install grep
brew install openssh
brew install screen
brew install curl
brew install wget
brew install bash bash-completion2
brew install zsh
brew install screen
brew install git git-lfs

terminal

brew cask install iterm2

1password (gerenciador de senhas)

brew cask install 1password

little snitch (firewall)

brew cask install litte-snitch

next cloud (storage remoto)

brew cask install nextcloud

browsers

brew cask install firefox google-chrome vivaldi brave-browser

torrent

brew cask install tranmission

remote management

brew install anydesk teamviewer

vpn

brew cask install forticlient viscosity

gpg

 brew install gpg-suite

k8s (kubernetes tools)

brew install rke kubectl kustomize helm

brew cask install lens

brew install derailed/k9s/k9s

chat

brew install mattermost slack rocket-chat microsoft-teams discord

im

brew cask install keynote weechat whatsapp telegram telegram-desktop

videconf

brew install zoom jitsi joinme skype 

docker

brew cask install docker

brew install docker-compose

editors

brew cask install libreoffice

brew cask install visual-studio-code macdown

documentations

brew install dash

virtualization

brew cask install virtualbox vagrant

automation

brew install terraform packer ansible

video players

brew cask install vlc mpv

terminal utils

brew install moreutils findutils

brew install ripgrep the_silver_searcher ack fzf

brew install tree

brew install asciinema

brew install tmux

brew install links 

brew install mtr

brew install nmap

brew install wget

brew install watch

brew install telnet

brew install netcat

brew install iperf

brew instll ipcalc

brew install geoip

brew install htop

brew install jq

brew install ffmpeg imagemagick

brew install unrar xz p7zip

brew install gnupg

brew install tcpdump tcptrace tcpflow tcping tcpreplay

fonts

fonts from brew

brew cask install font-ubuntu font-ubuntu-mono-derivative-powerline font-ubuntu-nerd-font font-ubuntumono-nerd-font font-fontawesome font-montserrat font-source-sans-pro font-roboto font-roboto-condensed font-roboto-mono font-roboto-slab font-roboto-mono-for-powerline font-robotomono-nerd-font font-open-sans font-open-sans-condensed font-open-sans font-open-sans-condensed

fonts from web

the bold font

wget https://dl.dafont.com/dl/?f=the_bold_font
unzip the_bold_font.zip
mv theboldfont.ttf  $HOME/Library/Fonts

calibri font

wget https://www.downloadfonts.io/wp-content/uploads/2018/12/calibri-font-sv.zip
unzip calibri-font-sv.zip
cd calibri\ font\ sv/
unzip Calibri\ Bold\ Italic.zip
unzip Calibri\ Bold.zip
unzip Calibri\ Italic.zip
unzip Calibri\ Light.zip
unzip Calibri\ Light\ Italic.zip
unzip Calibri\ Regular.zip
mv *.ttf $HOME/Library/Fonts

powerline fonts

git clone https://github.com/powerline/fonts
cd fonts
bash install.sh

vim

vundle vim

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

vimrc minimal

Edite o arquivo

vim ~/.vimrc

Insira o conteúdo abaixo

syntax on
filetype off                  " required
filetype plugin on
filetype indent on

set nocompatible              " be iMproved, required
set autoread
set encoding=utf8
set ffs=unix,dos,mac
set expandtab
set smarttab
set backspace=2
set laststatus=2

" Vundle

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'

Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'edkolev/promptline.vim'
Plugin 'dracula/vim'

Plugin 'bash-support.vim'
Plugin 'elzr/vim-json'
Plugin 'chase/vim-ansible-yaml'
Plugin 'rodjek/vim-puppet'

Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'

call vundle#end()            " required

colorscheme dracula

" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

abra o vim e digite

:PluginInstall

promptline shell for bash

Depois de instalar o airline abra o vim e digite

:PromptlineSnapshot ~/.promptline.sh airline

E insira isso na inicialização do bash

echo source ~/.promptline.sh > ~/.bash_profile

para testar digite

bash

gitignore

Crie o arquivo .gitignore (global)

vim ~/.gitignore

Adicione o conteúdo abaixo

# General
.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

gitconfig

Crie o arquivo .gitconfi

vim ~/.gitconfig

Adicione o conteúdo abaixo

[user]
  name = Guto Carvalho
  email = gutocarvalho@gmail.com
[alias]
  co = checkout
  ci = commit
  st = status
  br = branch
  d = diff
  ds = diff --stat
  dc = diff --cached
  s = status -s
  ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
  ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
  rao = remote add origin
  ac = !git add . && git commit -am
  pushitgood = push -u origin --all
  undo-commit = reset --soft HEAD~1
[core]
  editor = vim
  whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
  excludesfile = ~/.gitignore
[color]
  ui = auto
[color "branch"]
  current = yellow bold
  local = green bold
  remote = cyan bold
[color "diff"]
  meta = yellow bold
  frag = magenta bold
  old = red bold
  new = green bold
  whitespace = red reverse
[color "status"]
  added = green bold
  changed = yellow bold
  untracked = red bold
[diff]
  tool = vimdiff
[filter "lfs"]
  clean = git-lfs clean %f
  smudge = git-lfs smudge %f
  required = true
#[http]
#  sslVerify = false

editorconfig

Crie o arquivo .editorconfig

vim ~/.editorconfig

Adicione o conteúdo abaixo

# editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

screenrc

vim ~/.screenrc

Adicione o conteúdo abaixo

# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - cwills.sys@gmail.com

startup_message off

# Allow bold colors - necessary for some reason
attrcolor b ".I"

# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'

# Enables use of shift-PgUp and shift-PgDn
termcapinfo xterm|xterms|xs|rxvt ti@:te@

# Erase background with current bg color
defbce "on"

# Enable 256 color term
term xterm-256color

# Cache 30000 lines for scroll back
defscrollback 30000

hardstatus alwayslastline
# Very nice tabbed colored hardstatus line
hardstatus string '%{= Kd} %{= Kd}%-w%{= Kr}[%{= KW}%n %t%{= Kr}]%{= Kd}%+w %-= %{KG} %H%{KW}|%{KY}%101`%{KW}|%D %M %d %Y%{= Kc} %C%A%{-}'

# Hide hardstatus: ctrl-a f
bind f eval "hardstatus ignore"

# Show hardstatus: ctrl-a F
bind F eval "hardstatus alwayslastline"

curlrc

Crie o arquivo .curlrc

vim ~/.curlrc

Insira o conteúdo abaixo

connect-timeout = 60
insecure

wgetrc

Crie o arquivo .wgetrc

vim ~/.wgetrc

Insira o conteúdo abaixo

timeout = 60
check-certificate = off

oh my zsh

instalando projeto

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

instalando plugins via brew

brew install zsh-syntax-highlighting zsh-autosuggestions

zshrc minimal

edite o arquivo

vim ~/.zshrc

Insira o conteúdo abaixo

export ZSH="/Users/gutocarvalho/.oh-my-zsh"
ZSH_THEME="agnoster"
CASE_SENSITIVE="true"
ENABLE_CORRECTION="true"
HIST_STAMPS="mm/dd/yyyy"
plugins=(
  osx
  git
  brew
  docker
  docker-compose
  history
  vagrant
  zsh-syntax-highlighting
  zsh-autosuggestions
)
source $ZSH/oh-my-zsh.sh
export MANPATH="/usr/local/man:$MANPATH"
export LANG=en_US.UTF-8
if [[ -n $SSH_CONNECTION ]]; then
   export EDITOR='vim'
 else export EDITOR='atom'
fi
export PATH="$PATH:$HOME/.rvm/bin"
export VAGRANT_HOME="~/Storage/vagrant.d"
export VAGRANT_FORCE_COLOR=true
export PATH="/usr/local/sbin:$PATH"

dracula theme

Acesse o site do projeto https://draculatheme.com/

dracula iterm

git clone https://github.com/dracula/iterm.git

dracula macdown

git clone https://github.com/dracula/macdown.git

dracula vscode

instale via vscode extensions

mac tweaks

screen, ux, ui

diretório de screenshots

defaults write com.apple.screencapture location /Users/gutocarvalho/screenshots

seta png para screenshost

defaults write com.apple.screencapture type -string "png"

desabilita sombra nos screenshots

defaults write com.apple.screencapture disable-shadow -bool true

solicita senha no protetor de tela imediatamente

defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0

desabilita transparencias no macos

defaults write com.apple.universalaccess reduceTransparency -bool true

habilita gesto com scroll (ˆ) para dar zoom

defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true

desabilita o “press-n-hold” em favor da repetição do teclado

defaults write -g ApplePressAndHoldEnabled -bool false

sempre mosta os scrollbars

defaults write -g AppleShowScrollBars -string Always

desliga o diálogo “R U sure U want to open this app?”

defaults write com.apple.LaunchServices LSQuarantine -bool false

permite apps “from anyware”

defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool NO

finder & desktop

mostra icones adicionais no desktop

defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true

mostrando arquivos ocultos por default no finder

defaults write com.apple.finder AppleShowAllFiles -bool true

mostrando extensões de arquivos no finder

defaults write NSGlobalDomain AppleShowAllExtensions -bool true

mostrando status bar no finder

defaults write com.apple.finder ShowStatusBar -bool true

mostrando path bar no finder

defaults write com.apple.finder ShowPathbar -bool true

mostra path POSIX no título da janela

defaults write com.apple.finder _FXShowPosixPathInTitle -bool true

mantém pastas no topo da listagem do finder

defaults write com.apple.finder _FXSortFoldersFirst -bool true

quando fizer buscas, foca na pasta atual

defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"

desabilita o warning quando for limpar o lixo

defaults write com.apple.finder WarnOnEmptyTrash -bool false

desabilita o warning quando vai mudar a extensão de arquivos

defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

desabilita warning quando apaga algo do Icloud Drive

defaults write com.apple.finder FXEnableRemoveFromICloudDriveWarning -bool false

evita criar arquivos .DS_Store em volumes e shares em rede

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

abre uma janela finder quando um volume é montado

defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true

usa o ‘list view’ como padrão no finder

defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"

mostra o diretorio /Library no finder

sudo chflags nohidden /Library

mostra o diretório /Volumes no finder

sudo chflags nohidden /Volumes

mostra o diretorio ~/Library no finder

chflags nohidden ~/Library

Dock

ativa o hide do dock

defaults write com.apple.dock autohide -bool true

Misc

muda o tempo padrão de eventos para 30 minutos no ical

defaults write com.apple.iCal "Default duration in minutes for new event" 30

mostra ip, host e os-version ao clicar em clock na tela de login

sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName

seta apenas UTF8 no terminal padrão do mac

defaults write com.apple.terminal StringEncodings -array 4

seta timezone

sudo systemsetup -settimezone "America/Sao_Paulo" > /dev/null

refs

projetos


E ainda vem mais…..[s]Guto