mac-doc-常用

homebrew

1
2
3
4
5
6
7
# 进入命令行,输入
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# 或
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# 使用国内镜像
/bin/bash -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 安装软件
brew install 软件名

# 卸载软件
brew uninstall 软件名

# 更新homebrew库
brew update

# 更新homebrew
brew upgrade

# 查看安装的软件列表
brew list

# 查看安装包信息
brew info 软件名

# 查看安装路径
brew --cache

使用参考

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
# 安装python3
brew install python3

# 安装mongodb
brew install mongodb

# 安装git
brew install git
# 安装git-lfs
brew install git-lfs

# 安装nginx
brew search nginx÷÷
brew install nginx
# 查看nginx的conf目录
# 如果启动失败,将端口改成80端口
brew info nginx
# 查看nginx的http目录
brew list nginx
# 启动nginx
nginx
# 停止nginx
nginx -s stop
# 重启
nginx -s reload

问题

fatal: not in a git directory

1
2
3
4
5
brew -v

# 执行-v显示的结果
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

安装java

1
# https://www.oracle.com/java/technologies/downloads/#jdk20-mac 下载dmg

安装donet

1
# https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.302-macos-x64-installer

ssh

使用自带termial连接

1
ssh 用户名@服务器ip -p 端口号

文件描述符上限

app损坏

1
2
3
4
5
# 命令行输入
sudo xattr -r -d com.apple.quarantine
# 然后把app拖到命令行
# 例如拖动后
sudo xattr -r -d com.apple.quarantine /Applications/CLion.app

xcode自动选择证书不更新

  1. 进入用户的证书目录 /Users/用户名/Library/MobileDevice/Provisioning`
  2. 删掉老的xcode打包用的证书
  3. xcode重新下载证书

xcode-select: error: tool ‘xcodebuild’ requires Xcode

1
2
# 命令行输入
xcode-select --switch /Applications/Xcode.app/Contents/Developer/

远程连mac

共享里面开启远程桌面和远程连接

  • window 下载 realvnc连接
  • 使用ssh连接 ssh 用户名@ip地址