MacOS tips

Created on Sun, 06 Oct 11:32AM

Last changed on 2023-01-27 20:37:24

Restart mac network with specific interface

sudo ifconfig en7 down
sudo ifconfig en7 up

Preventing slee when close the lid

# 禁止自动睡眠
sudo pmset -b sleep 0; sudo pmset -b disablesleep 1
# 恢复关盖睡眠
sudo pmset -b sleep 5; sudo pmset -b disablesleep 0

Sudo with Touch ID

# /etc/pam.d/sudo
sudo gsed -i '1aauth	   sufficient' /etc/pam.d/sudo
sudo sed -i '' -e '1a\
auth       sufficient' /etc/pam.d/sudo #sudo touch id

Check listen port

sudo lsof -i -P | grep -i "listen"

Nmap or nc check

nc -zv [host-name/ip] [port(s)]

iTerm2 zmodem

zsh <(curl -sSL

Git user base on remote url

# ~/.gitconfig, need git version >= 2.36
[includeIf "hasconfig:remote.**/**"]
# [includeIf "hasconfig:remote.*.url:*/**"] # for https
	path = ~/.gitconfig-github

MacOS remove quarantine

xattr -d -r /Applications/ # or xxx binary

Other assets

Last updated