Mac 整理改变启动台图标大小显示/关闭隐藏文件vim 高亮显示行号文件所有权限安装 zsh安装插件zsh & bash 切换clashx 设置终端代理Brew 安装 卸载 常用操作git 设置 / 取消 代理git 修改用户名 & 邮箱npm 设置 / 取消代理npm 修改源Conda 设置安装 MySQL安装 redis简易安装部分禁止生成 .DS_Store 文件解决「已损坏」问题
# 设置一行 10 个defaults write com.apple.dock springboard-columns -int 10# 设置一列 8 个defaults write com.apple.dock springboard-rows -int 8defaults write com.apple.dock ResetLaunchPad -bool TRUEkillall Dock# 显示隐藏文件defaults write com.apple.finder AppleShowAllFiles -bool truekillall Finder
# 关闭隐藏文件defaults write com.apple.finder AppleShowAllFiles -bool falsekillall Findercp /usr/share/vim/vimrc ~/.vimrc
vim ~/.vimrc
syntax on # 主要是这一句set nu! # 显示行数,可以不加set autoindent # 自动缩进,加不加也可以vivsh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"修改命令行前缀
sudo vim /etc/zshrc
# 修改 PS1PS1="%m %1~ %# "# 自动提示插件 zsh-autosuggestionsgit clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 命令着色插件 zsh-syntax-highlightinggit clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
vim ~/.zshrc
# 添加 多个插件用空格分开plugins=(zsh-autosuggestions zsh-syntax-highlighting)从 bash 切换到 zsh
chsh -s /bin/zsh从 zsh 切换到 bash
xxxxxxxxxxchsh -s /bin/bashzsh & bash 的环境变量
xxxxxxxxxx# 临时echo export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
echo export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890 >> ~/.zshrcxxxxxxxxxx# brew 安装脚本/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo export PATH=/opt/homebrew/bin:$PATH >> ~/.zshrc
# 常用命令# 安装软件:brew install xxx# 卸载软件:brew uninstall xxx# 搜索软件:brew search xxx# 更新软件:brew upgrade xxx# 查看列表:brew list# 更新brew:brew update# 清理所有包的旧版本:brew cleanup# 清理指定包的旧版本:brew cleanup $FORMULA# 查看可清理的旧版本包,不执行实际操作:brew cleanup -nxxxxxxxxxx# 设置代理git config --global http.proxy http://127.0.0.1:7890git config --global https.proxy https://127.0.0.1:7890
# 取消代理git config --global --unset http.proxygit config --global --unset https.proxy
git config --global --listxxxxxxxxxxgit config --global user.name "LFool"git config --global user.email "1712199884@qq.com"xxxxxxxxxx# 设置代理npm config set proxy "http://127.0.0.1:7890"npm config set https-proxy "http://127.0.0.1:7890"
# 取消代理npm config delete proxynpm config delete https-proxy
# 查看所有 confignpm config listxxxxxxxxxxnpm config set registry 'https://registry.npm.taobao.org'xxxxxxxxxx# 不自动启动 conda 环境conda config --set auto_activate_base falsexxxxxxxxxx# 下载brew install mysql@5.7
# 配置环境变量echo 'export PATH="/opt/homebrew/Cellar/mysql@5.7/5.7.37/bin:$PATH"' >> ~/.zshrcsource ~/.zshrc
# 启动服务mysql.server start# 初始化mysql_secure_installation
Press y|Y for Yes, any other key for No: N # 密码长度必须8位以上(yes)Remove anonymous users? (Press y|Y for Yes, any other key for No) : y # 移除不用密码的那个账户Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n # 不接受root远程登录账号Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y # 删除text数据库Reload privilege tables now? (Press y|Y for Yes, any other key for No) : yxxxxxxxxxx# 下载brew install redis
# 启动 redis 服务# 方法一:使用 brewbrew services start redis# 方法二redis-server /usr/local/etc/redis.conf # 以指定配置启动服务redis-server # 以默认配置启动服务
# 使用客户端连接 redis(密码为空)redis-cli -h 127.0.0.1 -p 6379
# 测试127.0.0.1:6379> pingPONGxxxxxxxxxx# mavenbrew install maven# nodebrew install node# java8brew tap mdogan/zulubrew install --cask zulu-jdk8# miniforgebrew install --cask miniforgexxxxxxxxxx# 禁止生成 .DS_Store 文件defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE# 恢复生成 .DS_Store 文件defaults delete com.apple.desktopservices DSDontWriteNetworkStoresxxxxxxxxxxxattr -cr 应用路径