安装的软件
Intellj IDEAWebStormData GripVisual Studio Code
Apifox
AnotherRedisDesktopManagerDocker
Termius
OBS StudioChromeGit
xcode 中有 git,所以下载 xcode 就可以了,xcode 很多地方都用到,所以一般都会下载,推荐到官网下载,不去 app store 下载,因为 app store 下载的速度太慢了。
目前官网最新是 16.2,有 2.7GB, 解压后有 10GB 左右,所以下载和安装都需要时间。
Terminal
~/.zshrc
#terminal
export CLICOLOR=1
autoload -U colors && colors
export PROMPT="%{$fg_bold[green]%}it-fb %{$fg_bold[yellow]%}%1~ %# %{$reset_color%}"
tips: 保存后执行source ~/.zshrc生效
CLICOLOR=1 表示开启颜色
autoload -U colors && colors 表示加载颜色
%{$fg_bold[green]%} 表示将文本颜色设置为绿色并加粗
%{$fg_bold[yellow]%} 表示将文本颜色设置为黄色并加粗
%1~ 表示当前目录的第一个字符,~表示家目录
%# 表示命令提示符,%表示普通用户,#表示root用户
%{$reset_color%} 表示重置文本颜色
效果

FNM
~/.zshrc
#fnm
eval "$(fnm env --use-on-cd --shell bash)"
SDKMAN
~/.zshrc
#sdkman
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
压缩
如果使用苹果自带的压缩文件,不好的地方是不能设置密码,排除一些不需要的文件,如 .git, .DS_Store 等。
所以可以利用 bash 脚本,使用 zip 命令。
流程大概如下:
找到 自动操作 app

然后选取快速操作

注意红框选中的

排除所有隐藏文件
bash
#!/bin/bash
cd $(dirname "$1")
zip -r $(basename "$1").zip ./$(basename "$1") -x ".*" "*/.*" "*/__MACOSX/*"
排除 .git .github 文件夹
平时打包项目时,不需要把 .git .github 文件夹打包进去,可以使用下面的脚本。
bash
#!/bin/bash
cd $(dirname "$1")
zip -r $(basename "$1").zip ./$(basename "$1") -x "*/.git/*" "*/.github/*" "*/node_modules/*" "*/.DS_Store" "*/__MACOSX/*"
加密
利用苹果的脚本语言 AppleScript,可以弹出对话框获取密码,然后使用 zip 命令压缩文件。
bash
#!/bin/bash
# 使用 AppleScript 弹出对话框获取密码
PASSWORD=$(osascript -e 'Tell application "System Events" to display dialog "输入压缩包密码,不输入取消压缩" default answer "" with hidden answer buttons {"OK"} default button "OK"' -e 'text returned of result')
# 检查密码是否为空
if [ -z "$PASSWORD" ]; then
exit 0
fi
cd $(dirname "$1")
zip -r -P "$PASSWORD" $(basename "$1").zip ./$(basename "$1") -x "*/.DS_Store" "*/__MACOSX/*"
第一次使用时,会弹一个授权对话框,点击允许即可。

效果
