Pular para o conteúdo principal

Configurações iniciais para desenvolvimento no Mac

· 6 min para ler
Leandro Andrade
Leandro Andrade
Software Developer

Configurações iniciais para Mac:

Inicio

Instalar homebrew:

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

Atualizar homebrew:

brew update

Shell Programs

brew install git \
htop \
poppler \
jq \
pyenv \
nvm \
ripgrep \
fd \
neovim \
ffmpeg \
mole

GUI programs

brew install --cask \
visual-studio-code \
google-chrome \
rectangle \
orbstack \
postman \
protonvpn \
brave-browser \
cryptomator \
vlc \
latest \
ghostty \
proxyman \
microsoft-edge \
onedrive \
cleanshot \
bitwarden \
updf \
claude-code \
codex \
webstorm

Softwares Adicionais

  • intellij
  • datagrip
  • parallels

Git

Configurar gitconfig

touch ~/.gitconfig

Configurações:

[user]
name = username
email = email
[github]
user = username_github
[includeIf "gitdir:~/some/dir/"]
path = .another_gitconfig
[init]
defaultBranch = main
[pull]
rebase = true
[alias]
i = init
a = add
cm = commit -m
cma = commit --amend
cmam = commit --amend -m
s = status
pom = push origin main
pog = push origin gh-pages
puom = pull origin main
puog = pull origin gh-pages
cob = checkout -b
co = checkout
db = branch -d
dbr = push origin --delete
fp = fetch --prune --all
rs = reset --soft
rh = reset --hard
dl = branch -D
dr = push origin --delete
l = log --oneline
lg = log --oneline --decorate --graph
lga = log --oneline --decorate --graph --all
lgs = log --oneline --decorate --graph --stat
lt = log --graph --decorate --pretty=format:'%C(yellow)%h%Creset%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)%an%Creset'

ohmyzsh

Instalar ohmyzsh

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

.zshrc

Configurar .zshrc


## configs
eval "$(/opt/homebrew/bin/brew shellenv)"

# Added by OrbStack: command-line tools and integration
# This won't be added again if you remove it.
source ~/.orbstack/shell/init.zsh 2>/dev/null || :

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

alias ll='ls -la'
alias n='nvim'
alias d='docker'
alias g='git'

alias decompress="tar -xzf"

compress() { tar -czf "${1%/}.tar.gz" "${1%/}"; }

export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - zsh)"
export PATH="$HOME/.local/bin:$PATH"

y1080() {
yt-dlp -f "bv*[height<=1080][ext=mp4]+ba[ext=m4a]/b[height<=1080][ext=mp4]" \
-o "%(title)s.%(ext)s" \
"$1"
}

killport() {
if [ -z "$1" ]; then
echo "Uso: killport <porta>"
return 1
fi

PID=$(lsof -t -i:$1)

if [ -z "$PID" ]; then
echo "Nenhum processo usando a porta $1"
return 0
fi

kill -9 $PID
echo "Processo $PID finalizado (porta $1)"
}

nvm

Instalar nodejs:

nvm install v22.18.0

Definir a versão default:

nvm alias default v22.18.0

Pacotes globais:

npm i -g @anthropic-ai/claude-code npm-check-updates

npx playwright install
```# pyenv

Instalar python:
```sh
pyenv install 3.11.1

Definir a versão default:

pyenv global 3.11.1

Mac

Configurações do MacOS:

# Setting faster keyboard repeat rates...
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)

# Finder preferences Configuring enhanced Finder settings...
defaults write com.apple.finder AppleShowAllFiles YES
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder ShowStatusBar -bool true
defaults write com.apple.finder _FXSortFoldersFirst -bool true
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"

# System preferences configuring enhanced system and trackpad settings..."
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool true

# Text and input preferences configuring enhanced text and input settings..."
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
defaults write NSGlobalDomain NSTextMovementDefaultKeyTimeout -float 0.03

# Save and print dialog - expanding save and print dialogs by default..."
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true

# Performance and UI enhancements - optimizing window and UI performance..."
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 0

# Screenshot settings - configuring enhanced screenshot settings..."
mkdir -p ~/Screenshots
defaults write com.apple.screencapture type -string "png"
defaults write com.apple.screencapture "include-date" -bool "true"
defaults write com.apple.screencapture location -string "$HOME/Screenshots"
defaults write com.apple.screencapture disable-shadow -bool true

## Preventing .DS_Store file creation on network and USB volumes...
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

chflags nohidden ~/Library

# Dock settings - Removing Dock animation delays and clearing default apps..."
#defaults write com.apple.Dock autohide-delay -float 0
#defaults write com.apple.dock autohide-time-modifier -float 0
defaults write com.apple.dock expose-animation-duration -float 0.1
defaults write com.apple.dock springboard-show-duration -int 0
defaults write com.apple.dock springboard-hide-duration -int 0
defaults write com.apple.dock springboard-page-duration -int 0
#defaults write com.apple.dock persistent-apps -array
defaults write com.apple.dock mru-spaces -bool false

# Impede que aplicativos mudem automaticamente de Space ao serem focalizados
defaults write NSGlobalDomain AppleSpacesSwitchOnActivate -bool false

# Setting default save location to local disk instead of iCloud...
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false

# Disable Apple Intelligence
defaults write com.apple.CloudSubscriptionFeatures.optIn "545129924" -bool "false"

# Mostra percentual da bateria
defaults write com.apple.menuextra.battery ShowPercent -string "YES"

# Ativa zoom do mouse com scroll (útil para designers/desenvolvedores)
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true

# Ativa menu de desenvolvedor
sudo defaults write com.apple.Safari IncludeInternalDebugMenu -bool true

# Remove animações do Safari
sudo defaults write com.apple.Safari WebKitInitialTimedLayoutDelay 0.25

# Desabilita as etiquetas no Finder
defaults write com.apple.finder ShowRecentTags -bool false

# Remove etiquetas da sidebar
defaults write com.apple.finder SidebarTagsSctionDisclosedState -bool false

Atalhos para Spaces

Configurar Command+1 até Command+5 para ir direto ao Desktop/Space 1..5:

PLIST=~/Library/Preferences/com.apple.symbolichotkeys.plist
PB=/usr/libexec/PlistBuddy

$PB -c "Add :AppleSymbolicHotKeys dict" "$PLIST" 2>/dev/null || true

set_space_hotkey() {
local id="$1" char="$2" keycode="$3"

$PB -c "Delete :AppleSymbolicHotKeys:$id" "$PLIST" 2>/dev/null || true
$PB -c "Add :AppleSymbolicHotKeys:$id dict" "$PLIST"
$PB -c "Add :AppleSymbolicHotKeys:$id:enabled bool true" "$PLIST"
$PB -c "Add :AppleSymbolicHotKeys:$id:value dict" "$PLIST"
$PB -c "Add :AppleSymbolicHotKeys:$id:value:type string standard" "$PLIST"
$PB -c "Add :AppleSymbolicHotKeys:$id:value:parameters array" "$PLIST"
$PB -c "Add :AppleSymbolicHotKeys:$id:value:parameters:0 integer $char" "$PLIST"
$PB -c "Add :AppleSymbolicHotKeys:$id:value:parameters:1 integer $keycode" "$PLIST"
$PB -c "Add :AppleSymbolicHotKeys:$id:value:parameters:2 integer 1048576" "$PLIST"
}

set_space_hotkey 118 49 18 # Cmd+1 -> Desktop 1
set_space_hotkey 119 50 19 # Cmd+2 -> Desktop 2
set_space_hotkey 120 51 20 # Cmd+3 -> Desktop 3
set_space_hotkey 121 52 21 # Cmd+4 -> Desktop 4
set_space_hotkey 122 53 23 # Cmd+5 -> Desktop 5

killall cfprefsd 2>/dev/null || true
killall Dock

Observação: para esses atalhos funcionarem, o Mac precisa ter pelo menos 5 Spaces criados.

Vscode

Configuração do arquivo settings.json:

{
"editor.tabSize": 2,
"security.workspace.trust.untrustedFiles": "open",
"editor.minimap.enabled": false,
"git.ignoreMissingGitWarning": true,
"editor.fontSize": 12,
// "editor.occurrencesHighlight": "off",
// "editor.selectionHighlight": false,
"editor.suggestOnTriggerCharacters": false,
"editor.tabCompletion": "on",
"editor.quickSuggestions": {
"other": false,
"comments": false,
"strings": false
},
"files.trimTrailingWhitespace": true,
"git.confirmSync": false,
// "window.menuBarVisibility": "compact",
"git.openRepositoryInParentFolders": "always",
"extensions.ignoreRecommendations": true,
"window.titleBarStyle": "custom",
"workbench.iconTheme": "vscode-icons",
"vsicons.dontShowNewVersionMessage": true,
"update.showReleaseNotes": false
}

Extensões:

  • vscode-icons
  • markdown all in one
  • editorconfig