命令

  1. netstat -nl | grep 5432
  2. netstat -nat | grep 5432

lsof如果看不到netstat显示的端口的进程。前面加sudo就能看到了。

  1. sudo lsof -i :5432

查看文件

  1. stat foo
  2. # 另一种查看时间方式
  3. mdls foo
  1. sudo spctl --master-disable

Homebrew

国内源

  1. cd "$(brew --repo)"
  2. git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
  3. git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
  4. cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
  5. git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  6. git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
  1. export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
  2. export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles

执行生效

  1. # 更新Homebrew本身
  2. brew update

安装卸载

  1. brew install
  2. brew uninstall

更新

  1. # 更新所有
  2. brew upgrade
  3. # 更新指定
  4. brew upgrade foo
  5. # 查看哪些可以更新
  6. brew outdated

清理

  1. brew cleanup
  2. brew cleanup foo
  3. brew cleanup -n

锁住不想更新的包,brew update会忽略它

  1. brew pin foo
  2. brew unpin foo
  1. brew info foo
  2. brew info