mac start

在mac初始阶段中使用的一些记录

Brewfile

或许是一种优雅的备份和恢复软件列表的方式,从全新机器到可立即使用,参考文章
导出

1
brew bundle dump --describe --file="~/Brewfile"

批量安装

1
brew bundle --file="~/Brewfile"

常用demo

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
# command-line utilities

brew "cask" # homebrew extension to install apps with gui
brew "zsh" # shell better than bash
brew "zsh-autosuggestions"
brew "zsh-completions"
brew "zsh-syntax-highlighting"
brew "zsh-you-should-use"
brew "git"
brew "gh" # github cli
brew "ffmpeg" # video&audio process
# brew "postgresql@17" # database

# apps

cask "raycast" # better than spotlight
cask "firefox"
cask "google-chrome"
cask "visual-studio-code"
cask "postman"
cask "docker"
# cask "pgadmin4" # database management with gui
cask "zoom"
cask "snipaste" # screenshot
cask "vlc" # multi-media player, support almost all formats
cask "imageoptim" # image compression
# cask "bitwarden" # password manager
# cask "nordvpn" # privacy-preserving vpn service
# cask "ngrok" # expose local server to internet
# cask "obs" # screen recorder and realtime streamer

# fonts

cask "font-hack-nerd-font"
cask "font-menlo-for-powerline"
cask "font-jetbrains-mono"
cask "font-jetbrains-mono-nerd-font"

由于cask没有提供search功能,需要在官方网站上进行查找对应软件

Defaults(System Settings)

修改一些系统配置,GUI的入口太难找了,参考文章

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# tap-to-click
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
defaults -currentHost write -g com.apple.mouse.tapBehavior -int 1 # only for current user

# Disable the .DS file creation
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

# Finder
defaults write com.apple.finder "ShowPathbar" -bool "true" && killall Finder
defaults write com.apple.finder "AppleShowAllFiles" -bool "true" && killall Finder
## Sort folders first
defaults write com.apple.finder "_FXSortFoldersFirst" -bool "true" && killall Finder
defaults write com.apple.finder "_FXSortFoldersFirstOnDesktop" -bool "true" && killall Finder

# Apply the settings
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u

Alias

个人认为如果是单个cli内部的选项,没必要alias,用auto-suggestion更好,但针对cli组合还是比较难记忆的,似乎也不能做到suggest,最多只有history。参考文章

1
2
3
4
5
6
7
# zsh
alias openzsh="open ~/.zshrc"
alias sourcezsh="source ~/.zshrc"

# macOS
alias port="lsof -i"
alias stop="kill -9"