My macOS Config
For my new M2 MacBook Air.
Terminal
Install ‘oh-my-zsh’ and plugins
Install Xcode from App Store, OR install Xcode Commandline Tools using the following command
1
xcode-select --install
Install oh-my-zsh (Official website: ohmyz.sh)
1
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Note: If you are in China and cannot download because of GFW, use Clash and the following shortcuts to proxy your terminal.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15# proxy, created on 2024.07.23
enableproxy() {
export https_proxy=http://127.0.0.1:7890;
export http_proxy=http://127.0.0.1:7890;
export all_proxy=socks5://127.0.0.1:7890;
git config --global http.proxy http://127.0.0.1:7890;
git config --global https.proxy https://127.0.0.1:7890;
}
disableproxy() {
unset http_proxy;
unset https_proxy;
unset all_proxy;
git config --global --unset http.proxy;
git config --global --unset https.proxy;
}Install plugins.
zsh-syntax-highlighting
1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Then, to enable these plugins, open
~/.zshrc
and modify the lineplugins=(git)
to1
plugins=(git zsh-syntax-highlighting)
You may also enable some built-in useful plugins
1
plugins=(git zsh-syntax-highlighting colored-man-pages extract sudo z)
1 |
|
iTerm2
- Install iTerm2 and set as default terminal.
- Settings --> Appearance --> General —> Theme = Minimal
- Settings --> Profiles --> Colors --> Color Presets --> Solarized Dark High Contrast (Download from here and import it).
- Settings --> Profiles --> Window --> Transparency = 13, Keep background colors opaque = true, Blur = 13, Columns = 115
- Install MesloLGS-NF Font (download from here) and use that font.
Install HomeBrew
如果需要使用国内源,append the following to the end of ~/.zshrc
1 |
|
then install homebrew with
1 |
|
国内镜像
1 |
|
Reference: Homebrew 源使用帮助 - USTC Mirror Help
In order to run cracked applications
Allow apps downloaded from ‘Anywhere’.
1
sudo spctl --master-disable
Then in Settings --> Privacy & Security, you can see the option “Anywhere”.
Turn off SIP protection.
In recovery mode (For Intel Mac, press and hold ‘command+R’ after pressing power-on button; For Apple Silicon Mac, press and hold the power button until entering startup menu).
1
csrutil disable
This can prevent some annoying problems, such as
XprotectService
consuming your CPU after downloading some files, or your Mac refuses to open some unknown applications. But this will increase the risk your system being infected. Do with caution!sudo without password. Do with caution! Dangerous!
1
visudo
Modify the line
%admin ALL = (ALL) ALL
to1
%admin ALL = (ALL) NOPASSWD:ALL
GUI
Modify launchpad icon layout
You can modify the row number and column number the launchpad displays.
1
2
3defaults write com.apple.dock springboard-rows -int 5
defaults write com.apple.dock springboard-columns -int 10
killall DockTo restore default, use
1
2
3defaults write com.apple.dock springboard-rows Default
defaults write com.apple.dock springboard-columns Default
killall Dock
CLI-related miscellaneous things
Make
jpg
(instead ofpng
) the default screenshot filetype. This can significantly reduce screenshot size.1
defaults write com.apple.screencapture type jpg
Make
~/Library/
a visible folder.1
chflags nohidden ~/Library
Modify Hostname
Go to Settings, General, Sharing, scroll to the bottom.
Turn off ‘powernap’ and ‘tcpkeealive’. This disables wifi connection at system sleep to save battery power, but may result in features like ‘Find My Mac’ not to function properly. Do with caution!
1
2sudo pmset -a powernap 0
sudo pmset -a tcpkeepalive 0Fast Key Repeat Rate
In Settings, Keyboard, set Key repeat rate to the highest.
Useful GUI Software
Parallels Desktop: Allows you to run virtual machines including Windows 11 ARM.
It’s not a free software. You might need a cracked version. Reference: link
MOS: A lightweight tool used to let your mouse on macOS behave like Windows.
It’s open-source. Official website: mos.caldis.me
Rectangle Pro: Window manager.
It’s not a free software.
Crossover: with the help of Apple Game Porting Toolkit (GPTK), it allows you to run Windows games on your mac.
It’s not a free software.
Useful Command Line Software
Asitop: power measuring tool for Apple Silicon.
Install with python and pip.
Smartctl: a tool to view your hard disk usage.
Run with
smartctl -a disk0
.