MacBook Pro 参数
- MacBook Pro (16-inch, 2019)
- 2.6 GHz 6-Core Intel Core i7
- 16 GB 2667 MHz DDR4
- 512GB SSD
- AMD Radeon Pro 5300M 4 GB
-
系统偏好
Dock
从码头中删除大多数应用程序
- 自动隐藏
- 较小的码头
- “在码头中显示最新申请”
- “开放应用程序的显示指标”
-
显示
-
提示
-
触摸板
-
共享
修改电脑名
移除 Garage Band 和 音乐库 (如果不需要的话)
- 移除 IMovie (如果不需要的话)
更多从终端设置的配置
```htmltake screenshots as jpg (usually smaller size) and not png
defaults write com.apple.screencapture type jpg
do not open previous previewed files (e.g. PDFs) when opening a new one
defaults write com.apple.Preview ApplePersistenceIgnoreState YES
show Library folder
chflags nohidden ~/Library
show hidden files
defaults write com.apple.finder AppleShowAllFiles YES
show path bar
defaults write com.apple.finder ShowPathbar -bool true
show status bar
defaults write com.apple.finder ShowStatusBar -bool true
killall Finder;
<a name="uOLJF"></a>## Git在macOS上使用Git 用户需额外要求安装 Command Line Tools (CLT) for Xcode。<a name="j4UFu"></a>### 安装<a name="KaM7O"></a>#### 自动安装在终端输入```bashgit --version
如果没有安装Git,将会弹窗提示窗,根据提示安装即可。
如果有安装则显示出 git版本信息。如:
git version 2.32.0 (Apple Git-132)
手动安装
在终端中输入:
xcode-select --install
配置
配置全局用户名、全局邮箱作为配置信息:
git config --global user.name "your_name"git config --global user.email "your_email@youremail.com"
Git默认对大小写不敏感,也就是说,将一个文件名某个字母做了大小写转换的修改Git是忽略这个改动的,导致在同步代码时候会出现错误,所以建议把Git设置成大小写敏感。
git config core.ignorecase false
配置默认分支
// 这里是设置为 main 以前通常默认是 mastergit config --global init.defaultBranch main
优化Git日志显示
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
查看Git的配置信息
使用git config 指令查看配置信息:
git config --list
oh-my-zsh
Oh My Zsh是一个令人愉快的、开源的、社区驱动的用于管理Zsh配置的框架。它捆绑了数千个有用的功能,助手,插件,主题。
官方网站:https://ohmyz.sh/
安装
从清华大学镜像源安装
git clone https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.gitcd ohmyzsh/toolsREMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh install.sh
切换已有 ohmyzsh 至镜像源
git -C $ZSH remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.gitgit -C $ZSH pull
Homebrew
homebrew是macOS上的一个包管理器,仅需执行相应的命令,就能下载安装需要的软件包,可以省掉自己去下载、解压、拖拽(安装)等繁琐的步骤。
Homebrew 官方文档 https://brew.sh/
安装
这里使用 清华大学 镜像 保证使用中速度快于使用国外镜像。
首先,需要确保系统中安装了 bash、git 和 curl,对于 macOS 用户需额外要求安装 Command Line Tools (CLT) for Xcode。
接着,在终端输入以下几行命令设置环境变量:
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
最后,在终端运行以下命令以安装 Homebrew / Linuxbrew:
# 从本镜像下载安装脚本并安装 Homebrew / Linuxbrewgit clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install/bin/bash brew-install/install.shrm -rf brew-install# 也可从 GitHub 获取官方安装脚本安装 Homebrew / Linuxbrew/bin/bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/master/install.sh)"
这样在首次安装的时候也可以使用镜像。更多信息请参考 Homebrew 官方安装文档。
安装成功后需将 brew 程序的相关路径加入到环境变量中:
以下针对基于 Apple Silicon CPU 设备上的 macOS 系统(命令行运行 uname -m 应输出 arm64)上的 Homebrew:
test -r ~/.bash_profile && echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profiletest -r ~/.zprofile && echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
对基于 Intel CPU 设备上的 macOS 系统(命令行运行 uname -m 应输出 x86_64)的用户可跳过本步。
用法
```bash
查询:
brew search 软件名
安装:
brew install 软件名
卸载:
brew uninstall 软件名
更新 Homebrew:
brew update
查看 Homebrew 配置信息:
brew config
<a name="VcNFc"></a>## nodejs安装<a name="NqMDH"></a>### nvmnodejs版本管理工具。<a name="BYoPW"></a>#### 安装 nvm```bashcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash# 或wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
安装完成后刷新环境:
#bash:source ~/.bashrc#zsh:source ~/.zshrc#ksh:. ~/.profile
常用命令
// 查看可安装的nodejs版本nvm ls-reomte// 查看已安装版本nvm ls// 安装指定版本nvm install v16.15.0// 切换nodejs版本nvm use v16.15.0// 卸载nodejs版本nvm uninstall v16.15.0// 切换nodejs默认版本nvm alias default v17.0.0
查看node目录:
npm root -gnpm bin -g
nrm
nrm安装
# 使用淘宝镜像安装nrmnpm i nrm -g --registry=https://registry.npmmirror.com/
使用说明
// 查看已有仓库镜像nrm ls// 设置本地使用镜像nrm use <镜像名>// 添加仓库镜像nrm add <镜像名> <仓库地址>// 删除镜像nrm remove <镜像名>
VS Code
扩展推荐:
- Dracula Official (Theme)
- Auto Hide (Hides Sidebar)
- EditorConfig (Shared Config)
- ESLint (Code Style)
- Prettier (Code Format)
- Prettier: Formatting Toggle (Toggle Prettier)
- GitLens (Visualize Git)
- Better Comments (Comment Highlighting)
- Import Cost
- Highlight Matching Tag
- Auto Rename Tag
- Auto Close Tag
- Color Highlight
- ES7+ React/Redux/React-Native snippets
- VSCode React Refactor
- Vscode-styled-components
- Color Highlight
- Color Picker
- markdown-preview-enhanced
- GitHub.copilot
-
配置:
{"window.zoomLevel": 1,"editor.tabSize": 2,"editor.insertSpaces": true,"editor.wordWrap": "on","editor.trimAutoWhitespace": true,"editor.renderWhitespace": "all","editor.codeActionsOnSave": {"source.fixAll.tslint": true,"source.fixAll.eslint": true},"editor.formatOnSave": false,"editor.fontFamily": "'Source Code Pro','Fira Code','JetBrains Mono', Dank , Mono, Menlo","editor.fontSize": 16.0,"editor.lineHeight": 1.5,"editor.fontLigatures": true,"editor.fontWeight": "400","editor.tokenColorCustomizations": {"textMateRules": [{"scope": ["comment"],"settings": {"fontStyle": "italic"}},{"scope": [//following will be excluded from italics (VSCode has some defaults for italics)"constant","storage.modifier","storage.type","keyword.control","keyword.operator","invalid","entity.name.tag.doctype","entity.other.attribute-name","entity.other.attribute-name.tag.jade","entity.other.attribute-name.tag.pug"],"settings": {"fontStyle": "bold"}}]},"eslint.alwaysShowStatus": true,"eslint.options": {"extensions": [".js",".vue"]},"files.insertFinalNewline": true,"files.associations": {"*.vue": "vue","*.wpy": "vue","*.cjson": "jsonc","*.wxss": "css","*.wxs": "javascript","*.wxml": "html","*.tpl": "html","*.swig": "html","*.json5": "json","*.xml": "vue","*.art": "html"},"prettier.singleQuote": true,"prettier.semi": true,"vetur.validation.template": false,"files.exclude": {"**/.DS_Store": true,"**/.hg": true,"**/.idata": true,"**/.idea": true,"**/.svn": true,"**/CVS": true,"**/dist": false,"**/node_modules": false},"files.watcherExclude": {"**/.git/objects/**": true,"**/.git/subtree-cache/**": true,"**/node_modules/**": true,"**/tmp/**": true,"**/bower_components/**": true,"**/dist/**": true},"typescript.check.npmIsInstalled": false,"git.enableSmartCommit": true,"search.followSymlinks": true,"git.autofetch": true,"gitlens.advanced.messages": {},"files.trimTrailingWhitespace": true,"window.nativeTabs": true,"emmet.includeLanguages": {"wxml": "html"},// "minapp-vscode.disableAutoConfig": true,"extensions.ignoreRecommendations": false,"gitlens.views.repositories.files.layout": "list","gitlens.statusBar.alignment": "left","gitlens.mode.statusBar.alignment": "left","breadcrumbs.enabled": true,"[html]": {"editor.defaultFormatter": "esbenp.prettier-vscode"},"[javascript]": {"editor.defaultFormatter": "vscode.typescript-language-features"},"[json]": {"editor.defaultFormatter": "vscode.json-language-features"},"[css]": {"editor.defaultFormatter": "esbenp.prettier-vscode"},"[php]": {"editor.defaultFormatter": "kokororin.vscode-phpfmt"},"[less]": {"editor.defaultFormatter": "esbenp.prettier-vscode"},// "terminal.integrated.shell.osx": "zsh",// "terminal.integrated.fontFamily": "'DejaVu Sans Mono for powerline', 'Meslo LG S DZ for powerline', monospace","terminal.integrated.fontSize": 15,"terminal.integrated.lineHeight": 1.2,"workbench.settings.editor": "json","todo-tree.highlights.enabled": false,"[typescript]": {"editor.defaultFormatter": "vscode.typescript-language-features"},"[vue]": {"editor.defaultFormatter": "octref.vetur"},"[typescriptreact]": {"editor.defaultFormatter": "esbenp.prettier-vscode"},"[scss]": {"editor.defaultFormatter": "esbenp.prettier-vscode"},// powermode"powermode.enabled": true, // 启用效果"powermode.presets": "particles", // 是否启用震动"[javascriptreact]": {"editor.defaultFormatter": "esbenp.prettier-vscode" // 默认格式化器},"[markdown]": {// "editor.defaultFormatter": "yzhang.markdown-all-in-one",},"[jsonc]": {"editor.defaultFormatter": "vscode.json-language-features"},"workbench.iconTheme": "file-icons","terminal.integrated.allowChords": false,"terminal.integrated.sendKeybindingsToShell": true,"markdown-preview-enhanced.previewTheme": "vue.css","diffEditor.ignoreTrimWhitespace": false,"[nginx]": {"editor.defaultFormatter": "raynigon.nginx-formatter"},"editor.inlineSuggest.enabled": true,"gitlens.views.repositories.showBranchComparison": "branch","gitlens.menus": {"editor": {"blame": false,"clipboard": true,"compare": true,"history": false,"remote": false},"editorTab": {"clipboard": true,"compare": true,"history": true,"remote": true},"explorer": {"clipboard": true,"compare": true,"history": true,"remote": true},"scm": {"authors": true},"scmGroupInline": {"stash": true},"scmGroup": {"compare": true,"openClose": true,"stash": true},"scmItem": {"clipboard": true,"compare": true,"history": true,"remote": false,"stash": true}},"gitlens.views.commits.files.layout": "list","bracketPairColorizer.depreciation-notice": false,"github.copilot.enable": {"*": true,"yaml": false,"plaintext": false,"markdown": true},"redhat.telemetry.enabled": true,"powermode.shake.enabled": false,"editor.minimap.enabled": false,"editor.renderControlCharacters": false,"gitlens.defaultDateFormat": null,"git.confirmSync": false,"workbench.colorTheme": "Dracula",}
