mac自己的装机操作配置

记录一下自己常用的 Mac 操作配置。

1. 前置安装

1.1 系统设置

  1. 设置 -> 桌面与程序坞 -> Dock 右侧

  2. 密码修改为 1 位数

    1
    pwpolicy -clearaccountpolicies

然后去系统偏好设置 ->用户与群组 ->修改密码

1.2 软件前置

  1. Dropbox
  2. 1Password
  3. 百度输入法
  4. Chrome
  5. Obsidian

1.3 终端前置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 下载终端软件
https://github.com/alacritty/alacritty

# 显示隐藏文件
defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

# 安装brew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

# 软件
brew install trash
brew install rg
brew install rclone
brew install eza
brew install watch
brew install autossh
# 特效类
brew install fastfetch

2. 终端安装和配置

2.1 设置 SSH

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 1. 打开链接
https://github.com/unix2dos/LevonConfig/tree/main/Config

# 2. 只下载ssh文件夹,并放到家目录下,命名为 .ssh

# 3. 修改权限
sudo chmod 755 ~/.ssh
sudo chmod 600 ~/.ssh/*
sudo chown $USER ~/.ssh/*

# 4. 下载项目
cd workspace
git clone git@github.com:unix2dos/LevonConfig.git

# 5. 修改回去
rm -rf ~/.ssh
ln -s ~/workspace/LevonConfig/Config/ssh ~/.ssh


# 6. 再次修改权限
sudo chmod 755 ~/.ssh
sudo chmod 600 ~/.ssh/*
sudo chown $USER ~/.ssh/*

2.2 Tmux

1
2
3
4
5
6
7
8
9
10
11
# 安装tmux
brew install tmux

# 安装oh my tmux配置
cd ~
git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf

# 用自己的配置
rm -rf ~/.tmux.conf.local && ln -s ~/workspace/LevonConfig/Config/tmux/.tmux.conf.local ~/.tmux.conf.local
tmux source-file ~/.tmux.conf

2.3 zsh+plugin

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# oh my zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# 主题
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

# 插件
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

git clone https://github.com/wfxr/forgit.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/forgit

git clone https://github.com/so-fancy/diff-so-fancy.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/diff-so-fancy

# 下载安装 4 个 特殊字体(必须下载,终端使用)
https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k

# 配置
rm -rf ~/.zshrc && ln -s ~/workspace/LevonConfig/Config/zsh/.zshrc ~/.zshrc

2.4 Vim

1
2
3
4
5
6
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

ln -s ~/workspace/LevonConfig/Config/vim/.vimrc ~/.vimrc

vi
:PlugInstall

2.5 Fzf 模糊搜索

1
2
3
4
5
6
7
# 安装 fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
source ~/.zshrc

# fzf-tab
git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab

2.6 配置软链

1
2
3
4
5
6
7
8
9
10
11
12
# 终端alacritty
ln -s ~/workspace/LevonConfig/Config/alacritty/alacritty.toml ~/.alacritty.toml

# fastfetch
# ln -s ~/workspace/LevonConfig/Config/fastfetch/config.jsonc ~/.config/fastfetch/config.jsonc

# git
mkdir -p ~/.config/git/
ln -s ~/workspace/LevonConfig/Config/git/ignore ~/.config/git/ignore
ln -s ~/workspace/LevonConfig/Config/git/.gitconfig ~/.gitconfig
ln -s ~/workspace/LevonConfig/Config/git/.gitconfig-work ~/.gitconfig-work
ln -s ~/workspace/LevonConfig/Config/git/czrc ~/.config/.czrc

3. 项目

3.1 Blogs

1
2
3
4
# blog
cd ~ && mkdir workspace && cd workspace
git clone git@github.com:unix2dos/blog-readwrite.git
git clone git@github.com:unix2dos/blog-liuvv.git

3.2 Obsidian

1
2
3
4
5
6
7
8
9
10
11
12
#1. 设置软链接
ln -s ~/Dropbox/_Obsidian_ ~/workspace/Obsidian

#2. 下载整个 git 项目,把项目全部删除干净,只留下 .git 文件夹。
cd ~/workspace
git clone git@github.com:unix2dos/Obsidian.git --depth=1 a.git

#3. 然后把 .git 文件夹,重命名为第一台机器设置的文件夹和路径,然后 git status 查看。
mv a.git/.git /Users/liuwei/workspace/.gitdir_Obsidian
rm -rf a.git

# 4. 打开 obsidian,选择到 library 这一层

3.3 多重备份

1
2
3
4
5
6
7
8
9
10
11
12
13
# 1. 设置软链接
ln -s ~/Dropbox/_backups_ ~/workspace/backups


# 2. 下载整个 git 项目,把项目全部删除干净,只留下 .git 文件夹。
cd ~/workspace
git clone git@github.com:unix2dos/_backups_.git --depth=1 b.git

# 3. 然后把 .git 文件夹,重命名为第一台机器设置的文件夹和路径,然后 git status 查看。
mv b.git/.git /Users/liuwei/workspace/.gitdir_backups
rm -rf b.git

# 4. 进入 backups 文件夹,可以 git 查看了

3.4 开发配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# go
https://go.dev/dl/
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

# node nvm
https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script
nvm install stable
nvm ls

# python conda
https://www.anaconda.com/download
conda info -e

# rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • 软件安装
1
2
3
4
5
# 安装git commit 的 cz   (~/.config/.czrc)
npm i -g czg

# 安装 shell-gpt (~/.config/shell_gpt/.sgptrc) | sgpt 生产配置文件,修改 API_BASE_URL 和 apikey
pip install shell-gpt

4. 常用软件

4.1 应用软件

参考:https://www.liuvv.com/p/2e385ebc.html

  • 微信
  • Bob (导入配置)
  • ishot pro (就设置一个快捷键,其他快捷键全部取消)
  • alfred (xclient.info) (需要导入 config 配置,设置一下启动快捷键)
  • wps
  • charles
  • ice (菜单栏)
  • Typora (xclient.info)
  • BotGem | cherry-studio
  • F.lux
  • ClashX (百度网盘)https://github.com/clash-verge-rev/clash-verge-rev

4.2 开发软件

  • Navicat Premium Lite
  • Another Redis Desktop (支持导出配置)
  • Cursor
  • Postman
  • Orbstack

5. Mac 操作

5.1 Mac 设置

  • 打开夜览模式
  • 触发角
    • 左上:-
    • 右上:-
    • 左下:调度中心
    • 右下:应用程序窗口
  • 固定 F1-F12
    • 系统偏好设置 ->键盘 ->触控栏显示
  • 最小化程序到应用图标
    • 系统偏好设置 ->Dock->Mini windows into application icon
  • 访达配置
    • 开启新访达窗口,打开下载

5.2 软件设置

  • Typora
    • 图像 ->插入图片时: 复制到指定路径(./${filename})
    • 图像 -> 所有的选项全选中
  • Chrome Tab
    • Infinity 使用谷歌账号登录,使用云端数据
  • Cursor