## 1.安装Homebrew
```
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
## 2.将SSH KEY公钥添加到Linux服务器
```
方法一:
brew install ssh-copy-id
ssh-copy-id -i ~/.ssh/id_rsa.pub root@Linux服务器IP
方法二:
cat ~/.ssh/id_rsa.pub, 获取公钥
然后在Linux服务器上,编辑文件 vim ~/.ssh/authorized_keys,将公钥添加进去并保存
```
## 3.安装fswatch
```
brew install fswatch
```
## 4.编辑自动上传配置文件
```
sudo vim /mac-auto-deploy (编辑目录可自定义)
```
输入下在的内容:
```shell
#======
#!/bin/sh
local=$1
remote=$2
cd "$local" &&
fswatch . |xargs -n1 -I{} rsync -aztH --exclude .git --exclude .sass-cache --exclude .idea --delete --progress --rsh='ssh -l root -p22' . $remote
#======
```
## 5.在本地项目根目录中执行此命令
```
/mac-auto-deploy . root@Linux服务器IP:Linux服务器项目路径
```