Skip to content

Instantly share code, notes, and snippets.

@SongFuZhen
Last active May 31, 2023 12:49
Show Gist options
  • Save SongFuZhen/247935833d78958e87eae2834a2be7ac to your computer and use it in GitHub Desktop.
Save SongFuZhen/247935833d78958e87eae2834a2be7ac to your computer and use it in GitHub Desktop.

允许位置来源程序安装开启

sudo spctl --master-disable

Mac os 软件安装清单

数据库

Mysql
Postgresql

数据库连接工具

Navicat Premium

IDE

CUBA Studio
Android Studio

文本编辑器

VS Code
NotePad++
Cacher

浏览器

Chrome

虚拟机

VMWare Function

Office

Office 2016

邮件

Mail

环境

Node.js
JDK
Python
Maven
Redis

服务

Tomcat
Nginx

远程连接软件

RoyalTSX
向日葵
TeamViewer

其他

V2ray 翻墙
Git
AirDroid

Mac OS 系统设置管理员账户

情景

只有普通用户角色的用户,没有管理员角色的用户

误操作导致用户变为普通用户 / 二手电脑上的用户

前提:至少知道一个普通用户的密码

Command + R + 开机

电脑处于关机状态

先按下Command + R 键,然后再按下电源键开机

等待电脑进入恢复模式

进度条跑完之后,应该会进入到恢复模式,如下图

确认磁盘挂载完毕

Step1: 点击磁盘工具

Step2: 确保磁盘Machintosh HD已经挂载

如图,如果没有挂载,需要点击Mount进行挂载

Step3: 退出磁盘工具

使用实用工具 -> 终端

Step1: 进入 终端

如下图,进入终端

Step2: 输入命令,删除文件后重启电脑

如下图,准备输入命令

# 输入一下命令
-bash-3.2# cd /Volumns/Machintosh HD/var/db
-bash-3.2# ls -a 
-bash-3.2# cp .AppleSetupDone .AppleSetupDoneBak
-bash-3.2# rm .AppleSetupDone
-bash-3.2# reboot

重新开机

等重新开机之后,出现用户登录界面

输入普通用户密码进入系统

此时出现的界面,跟之前正常开机的界面是一样的,不要惊讶

选择一个普通用户,输入密码,然后登录系统。登录之后会自动出现创建账号界面

系统开始重新设置新账号

按照系统提示,一步一步操作下来即可

mac os 安装 homebrew

执行如下命令

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

使用 homebrew 安装 v2ray

参考地址: https://github.com/v2ray/homebrew-v2ray

# install
brew tap v2ray/v2ray
brew install v2ray-core

# update
brew update
brew upgrade v2ray-core

# uninstall
brew uninstall v2ray-core
brew untap v2ray/v2ray

报错

通过 brew 安装 redis Install Redis by brew

Step1: 安装 Redis

brew search redis # 可以省略
brew install redis

Step2: 启动 Redis(可选 Optional)

# 启动 redis
redis-server

Step3: 配置开机自启动(可选 Optional)

# 开启自启动
$ ln -f /usr/local/Cellar/redis/2.8.13/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Brew install flutter

Step1: install

brew install flutter

Step2: 配置 flutter 路径和国内镜像

# FLUTTER
export PUB_HOSTED_URL=https://pub.flutter-io.cn #国内用户需要设置
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn #国内用户需要设置

export PATH_TO_FLUTTER_GIT_DIRECTORY=/usr/local/opt/flutter
export PATH=${PATH_TO_FLUTTER_GIT_DIRECTORY}/bin:$PATH

brew install maven

Step1: install

brew install maven

Step2: 配置 Maven

export M2_HOME=/usr/local/Cellar/maven/3.6.3/libexec
export PATH=$PATH:$M2_HOME/bin

其他

export M2_HOME=/usr/local/opt/apache-maven-3.6.3

mac close oray auto startup

修改 plist,将 Disabled 节点的 false 修改为 true

cd /Library/LaunchAgents

sudo vim com.oray.sunlogin.agent.plist
sudo vim com.oray.sunlogin.startup.plist

cd /Library/LaunchDaemons
sudo vim com.oray.sunlogin.helper.plist
sudo vim com.oray.sunlogin.plist

macOS 在安装完 Ubuntu 20.04 之后,需要一些配置

1.修改 source.list,加快软件更新和下载

执行以下命令

cd /etc/apt/
mv source.list source.list.bak
sudo gedit source.list

deb http://mirrors.163.com/ubuntu/ focal main restricted
deb http://mirrors.163.com/ubuntu/ focal-updates main restricted
deb http://mirrors.163.com/ubuntu/ focal universe
deb http://mirrors.163.com/ubuntu/ focal-updates universe
deb http://mirrors.163.com/ubuntu/ focal multiverse
deb http://mirrors.163.com/ubuntu/ focal-updates multiverse
deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu focal-security main restricted
deb http://mirrors.163.com/ubuntu focal-security universe
deb http://mirrors.163.com/ubuntu focal-security multiverse

2.更新软件

sudo apt-get update

2.1 安装 vim (可选)

sudo apt-get remove vim-common
sudo apt-get install vim

2.2 安装 tweak tool (可选)

sudo add-apt-repository universe
sudo apt install gnome-tweak-tool

3. 修改 显示器

开启 使用 Retina 全分辨率显示

4. 设置 -> 显示器 -> 缩放 150%

打开 设置,将显示器缩放到 150%

5. 设置共享目录的挂载

su
sudo umount /mnt/hgfs
sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1000 -o gid=1000 -o umask=022
exit

编写端口转发

sudo vim /etc/pf.anchors/com.pow

修改 pf.conf

sudo vim /etc/pf.conf

scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
# 取消注释
#rdr-anchor "pow" 
dummynet-anchor "com.apple/*"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
# 取消注释
#load anchor "pow" from "/etc/pf.anchors/com.pow"

导入并运行pf

sudo pfctl -evf /etc/pf.anchors/com.pow

刷新 pf.conf

sudo pfctl -f /etc/pf.conf

开启自启

sudo pfctl -e

关闭 pf

sudo pfctl -d

美化 Terminal 终端

下载字体 MesloLGS NF

https://github.com/fontmgr/MesloLGSNF

主题

使用 git 下载主题

git clone https://github.com/mbadolato/iTerm2-Color-Schemes

安装主题

Command + , -> import -> terminal -> ayu

安装 powerlevel10k

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

使用 Reeder 添加 RSS 订阅,并查看

下载 Reeder5

https://xclient.info/s/reeder.html

添加 RSS 订阅地址

导入 OPML Feeds.opml

macOS Catalina 10.15 制作 iso 启动镜像

准备工作

  • 一台Mac
  • App Store 上下载好的 Install macOS Catalina.app
  • 足够的磁盘空间

开始转换 - 只需要10条命令即可

Step1:将 Install macOS Catalina.app 复制到 用户根目录下

mac@mac ~ % ls -l

drwxrwxrwx  1 ason  staff     1048576  7 29 00:40 Install macOS Catalina.app

Step2:第一条命令

hdiutil attach ~/Install\ macOS\ Catalina.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app

Step3:第二条命令

hdiutil create -o ~/Catalina.cdr -size 9216m -layout SPUD -fs HFS+J

Step3:第三条命令

hdiutil attach ~/Catalina.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build

Step4:第四条命令

asr restore -source ~/Install\ macOS\ Catalina.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase

Step5:第五条命令

mkdir -p /Volumes/macOS\ Base\ System/System/Installation

Step6:第六条命令

cp -rp /Volumes/install_app/Packages/ /Volumes/macOS\ Base\ System/System/Installation/

Step7:第七条命令

cp -rp ~/Install\ macOS\ Catalina.app/Contents/SharedSupport/BaseSystem.chunklist /Volumes/macOS\ Base\ System/BaseSystem.chunklist

Step8:第八条命令

cp -rp ~/Install\ macOS\ Catalina.app/Contents/SharedSupport/BaseSystem.dmg /Volumes/macOS\ Base\ System

Step9:第九条命令

hdiutil detach /Volumes/install_app

Step10:推出镜像

从桌面上推出镜像

Step11:第十条命令

hdiutil convert ~/Catalina.cdr.dmg -format UDTO -o ~/Catalina.iso

以上

在 mac 系统上禁止 .* 文件

参考文件:https://www.cnblogs.com/zlstg/articles/15214319.html

删除所有.* 文件

sudo find ./ -name ".DS_Store" -depth -exec rm {} \;

关闭 .DS_Store 文件

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

开启 .DS_Store 文件

defaults delete com.apple.desktopservices DSDontWriteNetworkStores 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment