Mac 重要配置和软件使用记录
graphviz
1brew install libtool
2brew link libtool
3brew install graphviz
4brew link --overwrite graphviz
By default, the dot executable is expected:
- Firstly in: /usr/local/bin/dot
- Then in: /usr/bin/dot
You can also specify the environment variable GRAPHVIZ_DOT
to set the exact location of your GraphViz executable.
ffmpeg
1brew install ffmpeg
Pngpaste
1brew install pngpaste
Picgo
1npm install picgo -g
2picgo add picgo-plugin-sftp-uploader
1// ~/.picgo/config.json
2// https://picgo.github.io/PicGo-Core-Doc/zh/guide/commands.html#use
3{
4 "picBed": {
5 "uploader": "sftp-uploader",
6 "current": "sftp-uploader",
7 "transformer": "path",
8 "sftp-uploader": {
9 "site": "akynazh.site",
10 "configFile": "/Users/zh/.picgo/sftp.json"
11 }
12 },
13 "picgoPlugins": {
14 "picgo-plugin-sftp-uploader": true
15 }
16}
17
18// ~/.picgo/sftp.json
19// https://github.com/imba97/picgo-plugin-sftp-uploader
20{
21 "s1": {
22 "url": "https://akynazh.site",
23 "path": "/images/pub/{fullName}",
24 "uploadPath": "/var/www/html/images/pub/{fullName}",
25 "host": "a.b.c.d",
26 "port": 22,
27 "username": "root",
28 "privateKey": "/Users/zh/.ssh/id_rsa",
29 "passphrase": "xxxxxxxxxx",
30 "fileUser": "www",
31 "dirMode": "0755"
32 }
33}
ftp
1brew install inetutils
Applite
一个方便地卸载、安装、更新 Mac 各类软件(含 brew 源)的工具。
1brew install --cask applite
Hostname
1sudo scutil --set HostName MacBookPro-Jzh
2scutil --get HostName
3
4# setting -> general -> sharing -> Local hostname
5sudo scutil --set LocalHostName MacBookPro-Jzh
6scutil --get LocalHostName
Vsce
Vscode 扩展开发工具,用于打包和发布等。
1npm install -g vsce
2# usage
3vsce package
MySQL
1brew search mysql
2==> Formulae
3automysqlbackup mysql-client mysql-client@8.4 mysql@5.7 mysqltuner
4mysql mysql-client@5.7 mysql-connector-c++ mysql@8.0 qt-mysql
5mysql++ mysql-client@8.0 mysql-search-replace mysql@8.4
6
7==> Casks
8mysql-connector-python mysqlworkbench sqlpro-for-mysql
9mysql-shell navicat-for-mysql
10brew install mysql@8.0
11brew services start mysql@8.0
12echo 'export PATH="/usr/local/opt/mysql@8.0/bin:$PATH' >> ~/.zprofile && source ~/.zprofile
13mysql_secure_installation
14mysql -u root -p
Apple Map 没有同步指南等信息
Mac 上设置 - icloud,关闭 Apple Map 同步,退出后重新打开 Apple Map,然后打开 Apple Map 同步。
添加苹果官方节假日日历地址
1大陆节日
2webcal://p10-calendars.icloud.com/holiday/CN_zh.ics
3台湾节日
4webcal://p10-calendars.icloud.com/holiday/TW_zh.ics
5香港节日
6webcal://p10-calendars.icloud.com/holiday/HK_zh.ics
7美国节假
8webcal://p10-calendars.icloud.com/holiday/US_en.ics
9日本节假
10webcal://p10-calendars.icloud.com/holiday/JP_ja.ics
11澳大利亚
12webcal://p10-calendars.icloud.com/holiday/AU_en.ics
13法国节假
14webcal://p10-calendars.icloud.com/holiday/FR_fr.ics
15德国节假
16webcal://p10-calendars.icloud.com/holiday/DE_de.ics
17英国节假
18webcal://p10-calendars.icloud.com/holiday/GB_en.ics
Apple Map - 系统语言为英文时修改内置地图软件语言为中文
先将 [View]-> [Labels]-> [Always Show Labels in English] 取消即可在地图上显示中文。
如果需要将搜索内容也改成中文,需要设置 macOS 特定 app 的语言。
1defaults write com.apple.maps AppleLanguages '(zh-CN)'
可以将菜单栏,搜索内容变为中文。(想变回英文只需将最后改成’(“en-US”)’)
Steam 下载 Windows 游戏文件
Navigate to /Users/YOUR_USERNAME_HERE/Library/Application Support/Steam/steamapps/. Create a file called appmanifest_22320.acf (the number is based on its Steam App ID). If using TextEdit, make sure that your document is in plain text mode by going to the menu bar and choosing “Format” -> “Make Plain Text”. Also, ensure that it’s not named with the extension .acf.txt. Add the following into that file:
1"AppState"
2{
3 "AppID" "22320"
4 "Universe" "1"
5 "StateFlags" "1026"
6 "installdir" "The Elder Scrolls III - Morrowind"
7}
Launch the Steam client and let it download. You can then find Morrowind.esm at ~/Library/Application Support/Steam/steamapps/common/The Elder Scrolls III - Morrowind/Data Files/
desktop 文件夹里有东西,但是桌面不显示,而且无法拖动任何文件到桌面
原因是一些破解软件修改了系统配置造成的。
1defaults write com.apple.finder CreateDesktop -bool true; killall Finder
dart
1brew tap dart-lang/dart
2brew install dart
Apple Book
将导出的 epub 文件夹转为 epub 文件
Right click on the .epub file and click on Show Package Contents.
Select all the contents (CMD + A) → Right click → Compress.
This will create a .zip file. Simply change the extension from .zip to .epub and voila! The file has become an ePub document.
textutil
用于转换 webarchive 为文件夹,好像是内置的。
1textutil -convert html /Users/USERNAME/NAME.webarchive
REST 测试插件
- vsc: rest client
- idea: http client
环境变量分别写在:
- .vscode/settings.json
- .http 同一目录下
http 文件内字符串变量统一不加引号
Jenkins
1wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
2java -jar jenkins.war --httpPort=8080
3open http://localhost:8080 # and then set up in browser
RocketMQ
1wget https://dist.apache.org/repos/dist/release/rocketmq/5.1.4/rocketmq-all-5.1.4-bin-release.zip
2unzip rocketmq-all-5.1.4-bin-release.zip
3sudo mkdir -p /usr/local/share/rocketmq && sudo mv rocketmq-all-5.1.4-bin-release /usr/local/share/rocketmq/
4
5# start
6cd /usr/local/share/rocketmq/rocketmq-all-5.1.4-bin-release/bin
解压缩工具
p7zip
1brew install p7zip
27za x test.7z
3
4# 分卷解压【其他格式类似】
5cat t1.7z > t.7z
6cat t1.7z.001 >> t.7z
7cat t1.7z.002 >> t.7z
87za x t.7z
unzip
1brew install unzip
2unzip test.zip
rar
1brew install rar
2unrar x test.rar
tar
1tar -zxf test.tar.gz
alist
1cd $dld
2wget https://github.com/alist-org/alist/releases/download/v3.30.0/alist-darwin-arm64.tar.gz
3tar -zxvf alist-darwin-arm64.tar.gz
4chmod +x alist
5sudo mkdir /usr/local/share/alist
6sudo mv alist /usr/local/share/alist
7# echo 'export PATH="$PATH:/usr/local/share/alist"' >> ~/.zprofile
8# source ~/.zprofile
9
10data_dir="/Users/zh/.alist"
11# mkdir data folder
12mkdir "$data_dir"
13# start server
14cd "$data_dir" && alist server
15# get admin info
16cd "$data_dir" && alist admin
17# add some storages
18# ...
后台服务,开机自启,vim ~/Library/LaunchAgents/ci.nn.alist.plist
:
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3<plist version="1.0">
4 <dict>
5 <key>Label</key>
6 <string>ci.nn.alist</string>
7 <key>KeepAlive</key>
8 <true/>
9 <key>ProcessType</key>
10 <string>Background</string>
11 <key>RunAtLoad</key>
12 <true/>
13 <key>WorkingDirectory</key>
14 <string>/Users/zh/.alist</string>
15 <key>ProgramArguments</key>
16 <array>
17 <string>/usr/local/share/alist/alist</string>
18 <string>server</string>
19 </array>
20 </dict>
21</plist>
1launchctl load ~/Library/LaunchAgents/ci.nn.alist.plist
2# 开启: launchctl start ~/Library/LaunchAgents/ci.nn.alist.plist
3# 关闭: launchctl stop ~/Library/LaunchAgents/ci.nn.alist.plist
4# 卸载配置: launchctl unload ~/Library/LaunchAgents/ci.nn.alist.plist
SMB 共享
mac 通用 -> 共享 -> 文件共享开启 -> 指定共享文件夹和权限控制(可选)
iphone 文件 -> 连接服务器 -> 输入 Mac-Jzh.local(本机名称 + .local) -> 输入 Mac 账号密码(或以客人模式登录)
将快速操作和快捷指令添加到右键
Automator 创建快速操作(注意输入类型和适用 APP),然后设置 -> 键盘 -> 键盘快捷键 -> 服务 -> 勾选
快捷指令详细信息勾选快速操作, 编辑快捷指令,然后设置 -> 隐私与安全性 -> 扩展 -> 访达 -> 勾选
阻止 Anydesk 开机自启
删除该文件:
1/Library/LaunchAgents/com.philandro.anydesk.Frontend.plist
MAC 禁用系统输入法
sudo open ~/Library/Preferences/com.apple.HIToolbox.plist
AppleEnabledInputSources -> remove {KeyboardLayout=ABC} -> save
访达 -> 进入文件夹 ~/Library/Preferences/com.apple.HIToolbox.plist -> 右键显示简介 -> 已锁定 v
PS: 在 Ventura 版本下成功
MAC Ventura 真正进入 Recovery
进入恢复模式操作步骤为:1.长按电源键 2.长按直到启动选项出现 3.正在载入启动选项 4.选项界面
而如果在【3.正在载入启动选项】页面时就松开电源键了,在选项界面后续操作中,虽然是在恢复模式的界面,但是系统却认为不是在恢复模式。
解决方式:
长按电源键直到【4.选项界面 】出现后再松手即可!
开机启动程序
1chmod +x startup.sh
2# 访达右键 startup.sh > 显示详情 > 打开方式选终端
3# 设置 > 通用 > 登录项添加 startup.sh
禁止系统更新和提示
1# /etc/hosts
2
3127.0.0.1 swdist.apple.com
4127.0.0.1 swscan.apple.com
5127.0.0.1 swcdn.apple.com #optional, download url
6127.0.0.1 gdmf.apple.com
7127.0.0.1 mesu.apple.com
8127.0.0.1 xp.apple.com
1alias fkred="defaults delete com.apple.systempreferences AttentionPrefBundleIDs; defaults delete com.apple.systempreferences DidShowPrefBundleIDs; killall Dock"
2fkred
MySQL
1brew install mysql pkg-config
2brew services start mysql
3mysql -uroot
4ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
5mysql -uroot -p123456
Github CLI
1brew install gh
Hugo
1brew install hugo
SteamCMD
1cd /usr/local/share
2curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_osx.tar.gz" | tar zxvf -
3./steamcmd
4login {username} {password}
5
6# 下载创意工坊物品
7workshop_download_item {game-id} {id}
8# Wallpaper Engine
9workshop_download_item 431960 {id}
InfluxDb
1brew install influxdb influxdb-cli
2# start influxdb
3influxdb
4# setup a bucket
5influx setup
6# currently v2, use v1 shell by:
7influx v1 shell
rar
1brew install rar
2touch a.txt
3touch b.txt
4rar a t.rar a.txt b.txt
5unrar x t.rar
python(多版本)
1brew install pyenv
2v="3.10.9"
3pyenv install $v
4pyenv versions
5pyenv global $v
6pyenv init # 然后根据提示添加变量到文件
7python -V
8python3 -V
9pip -V
10pip3 -V
11
12# 针对某个项目指定 python 版本
13v="3.9.13"
14pyenv install $v
15cd your_project
16~/.pyenv/versions/$v/bin/python -m venv venv
17source ./venv/bin/activate
bat
加强版 cat。
1brew install bat
ripgrep
加强版 grep。
1brew install ripgrep
fzf
命令行模糊搜索工具。
1brew install fzf
rclone mount
首先安装 macfuse
文档需知: “rclone will locate the macFUSE libraries without any further intervention”
接着:
1# 后台运行时不可使用 kill 操作,需要使用 umount ~/Pikpak 操作
2nnohup rclone mount --vfs-cache-mode writes pikpak: ~/Pikpak
pikpakcli
1wget https://github.com/52funny/pikpakcli/releases/download/v0.15/pikpakcli_0.15_Darwin_arm64.tar.gz
2tar -zxvf pikpakcli_0.15_Darwin_arm64.tar.gz
3mv ./pikpakcli /usr/local/bin/
4pikpakcli -h
5mkdir -p ~/.config/pikpakcli
6echo "username:" >> ~/.config/pikpakcli/config.yml
7echo "password:" >> ~/.config/pikpakcli/config.yml
8vim ~/.config/pikpakcli/config.yml
hiddenbar
1brew install --cask hiddenbar
node
同 linux, 详见 Linux 重要软件安装和配置记录。
maven
若需要特定版本,操作方法同 linux, 详见 Linux 重要软件安装和配置记录。
否则可直接通过 brew:
1brew install maven
brew
1/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
docker
1brew install --cask docker
2open /Applications/Docker.app
syncthing
1brew install syncthing
2brew services start syncthing
redis
1brew install redis
2brew services start redis
3redis-cli
4
5vim /opt/homebrew/etc/redis.conf
6requirepass xxx
7brew services restart redis
man zh page
1wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/manpages-zh/manpages-zh-1.5.1.tar.gz --no-check-certificate
2tar -zxvf manpages-zh-1.5.1.tar.gz
3cd manpages-zh-1.5.1
4./configure --disable-zhtw
5sudo make && sudo make install
6man -M /usr/local/share/man/zh_CN grep
7alias mann="man -M /usr/local/share/man/zh_CN"
postgresql
1brew install postgresql@15
2brew services start postgresql@15
3## vim ~/.zprofile
4export PATH="/opt/homebrew/opt/postgresql@15/bin:$PATH"
5export LDFLAGS="-L/opt/homebrew/opt/postgresql@15/lib"
6export CPPFLAGS="-I/opt/homebrew/opt/postgresql@15/include"
7psql postgres
jq
1brew install jq
lux
一个视频下载器
1brew install lux