├── assets ├── mac-icon-dock.png ├── mac-icon-menu.png ├── mac-icon-finder.png ├── idea-jdk-download.jpg ├── remove-dock-icon.png ├── install-code-in-path.jpg ├── install-xcode-select.png ├── iterm-profile-usage.jpg ├── lemon-clean-rosetta.jpg ├── remove-desktop-icon.png ├── select-app-platform.jpg ├── install-any-source-app.jpg └── iterm-profile-setting.jpg ├── LICENSE └── README.md /assets/mac-icon-dock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/mac-icon-dock.png -------------------------------------------------------------------------------- /assets/mac-icon-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/mac-icon-menu.png -------------------------------------------------------------------------------- /assets/mac-icon-finder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/mac-icon-finder.png -------------------------------------------------------------------------------- /assets/idea-jdk-download.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/idea-jdk-download.jpg -------------------------------------------------------------------------------- /assets/remove-dock-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/remove-dock-icon.png -------------------------------------------------------------------------------- /assets/install-code-in-path.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/install-code-in-path.jpg -------------------------------------------------------------------------------- /assets/install-xcode-select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/install-xcode-select.png -------------------------------------------------------------------------------- /assets/iterm-profile-usage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/iterm-profile-usage.jpg -------------------------------------------------------------------------------- /assets/lemon-clean-rosetta.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/lemon-clean-rosetta.jpg -------------------------------------------------------------------------------- /assets/remove-desktop-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/remove-desktop-icon.png -------------------------------------------------------------------------------- /assets/select-app-platform.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/select-app-platform.jpg -------------------------------------------------------------------------------- /assets/install-any-source-app.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/install-any-source-app.jpg -------------------------------------------------------------------------------- /assets/iterm-profile-setting.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shockerli/mac-initialize/HEAD/assets/iterm-profile-setting.jpg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution 4.0 International Public License 58 | 59 | By exercising the Licensed Rights (defined below), You accept and agree 60 | to be bound by the terms and conditions of this Creative Commons 61 | Attribution 4.0 International Public License ("Public License"). To the 62 | extent this Public License may be interpreted as a contract, You are 63 | granted the Licensed Rights in consideration of Your acceptance of 64 | these terms and conditions, and the Licensor grants You such rights in 65 | consideration of benefits the Licensor receives from making the 66 | Licensed Material available under these terms and conditions. 67 | 68 | 69 | Section 1 -- Definitions. 70 | 71 | a. Adapted Material means material subject to Copyright and Similar 72 | Rights that is derived from or based upon the Licensed Material 73 | and in which the Licensed Material is translated, altered, 74 | arranged, transformed, or otherwise modified in a manner requiring 75 | permission under the Copyright and Similar Rights held by the 76 | Licensor. For purposes of this Public License, where the Licensed 77 | Material is a musical work, performance, or sound recording, 78 | Adapted Material is always produced where the Licensed Material is 79 | synched in timed relation with a moving image. 80 | 81 | b. Adapter's License means the license You apply to Your Copyright 82 | and Similar Rights in Your contributions to Adapted Material in 83 | accordance with the terms and conditions of this Public License. 84 | 85 | c. Copyright and Similar Rights means copyright and/or similar rights 86 | closely related to copyright including, without limitation, 87 | performance, broadcast, sound recording, and Sui Generis Database 88 | Rights, without regard to how the rights are labeled or 89 | categorized. For purposes of this Public License, the rights 90 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 91 | Rights. 92 | 93 | d. Effective Technological Measures means those measures that, in the 94 | absence of proper authority, may not be circumvented under laws 95 | fulfilling obligations under Article 11 of the WIPO Copyright 96 | Treaty adopted on December 20, 1996, and/or similar international 97 | agreements. 98 | 99 | e. Exceptions and Limitations means fair use, fair dealing, and/or 100 | any other exception or limitation to Copyright and Similar Rights 101 | that applies to Your use of the Licensed Material. 102 | 103 | f. Licensed Material means the artistic or literary work, database, 104 | or other material to which the Licensor applied this Public 105 | License. 106 | 107 | g. Licensed Rights means the rights granted to You subject to the 108 | terms and conditions of this Public License, which are limited to 109 | all Copyright and Similar Rights that apply to Your use of the 110 | Licensed Material and that the Licensor has authority to license. 111 | 112 | h. Licensor means the individual(s) or entity(ies) granting rights 113 | under this Public License. 114 | 115 | i. Share means to provide material to the public by any means or 116 | process that requires permission under the Licensed Rights, such 117 | as reproduction, public display, public performance, distribution, 118 | dissemination, communication, or importation, and to make material 119 | available to the public including in ways that members of the 120 | public may access the material from a place and at a time 121 | individually chosen by them. 122 | 123 | j. Sui Generis Database Rights means rights other than copyright 124 | resulting from Directive 96/9/EC of the European Parliament and of 125 | the Council of 11 March 1996 on the legal protection of databases, 126 | as amended and/or succeeded, as well as other essentially 127 | equivalent rights anywhere in the world. 128 | 129 | k. You means the individual or entity exercising the Licensed Rights 130 | under this Public License. Your has a corresponding meaning. 131 | 132 | 133 | Section 2 -- Scope. 134 | 135 | a. License grant. 136 | 137 | 1. Subject to the terms and conditions of this Public License, 138 | the Licensor hereby grants You a worldwide, royalty-free, 139 | non-sublicensable, non-exclusive, irrevocable license to 140 | exercise the Licensed Rights in the Licensed Material to: 141 | 142 | a. reproduce and Share the Licensed Material, in whole or 143 | in part; and 144 | 145 | b. produce, reproduce, and Share Adapted Material. 146 | 147 | 2. Exceptions and Limitations. For the avoidance of doubt, where 148 | Exceptions and Limitations apply to Your use, this Public 149 | License does not apply, and You do not need to comply with 150 | its terms and conditions. 151 | 152 | 3. Term. The term of this Public License is specified in Section 153 | 6(a). 154 | 155 | 4. Media and formats; technical modifications allowed. The 156 | Licensor authorizes You to exercise the Licensed Rights in 157 | all media and formats whether now known or hereafter created, 158 | and to make technical modifications necessary to do so. The 159 | Licensor waives and/or agrees not to assert any right or 160 | authority to forbid You from making technical modifications 161 | necessary to exercise the Licensed Rights, including 162 | technical modifications necessary to circumvent Effective 163 | Technological Measures. For purposes of this Public License, 164 | simply making modifications authorized by this Section 2(a) 165 | (4) never produces Adapted Material. 166 | 167 | 5. Downstream recipients. 168 | 169 | a. Offer from the Licensor -- Licensed Material. Every 170 | recipient of the Licensed Material automatically 171 | receives an offer from the Licensor to exercise the 172 | Licensed Rights under the terms and conditions of this 173 | Public License. 174 | 175 | b. No downstream restrictions. You may not offer or impose 176 | any additional or different terms or conditions on, or 177 | apply any Effective Technological Measures to, the 178 | Licensed Material if doing so restricts exercise of the 179 | Licensed Rights by any recipient of the Licensed 180 | Material. 181 | 182 | 6. No endorsement. Nothing in this Public License constitutes or 183 | may be construed as permission to assert or imply that You 184 | are, or that Your use of the Licensed Material is, connected 185 | with, or sponsored, endorsed, or granted official status by, 186 | the Licensor or others designated to receive attribution as 187 | provided in Section 3(a)(1)(A)(i). 188 | 189 | b. Other rights. 190 | 191 | 1. Moral rights, such as the right of integrity, are not 192 | licensed under this Public License, nor are publicity, 193 | privacy, and/or other similar personality rights; however, to 194 | the extent possible, the Licensor waives and/or agrees not to 195 | assert any such rights held by the Licensor to the limited 196 | extent necessary to allow You to exercise the Licensed 197 | Rights, but not otherwise. 198 | 199 | 2. Patent and trademark rights are not licensed under this 200 | Public License. 201 | 202 | 3. To the extent possible, the Licensor waives any right to 203 | collect royalties from You for the exercise of the Licensed 204 | Rights, whether directly or through a collecting society 205 | under any voluntary or waivable statutory or compulsory 206 | licensing scheme. In all other cases the Licensor expressly 207 | reserves any right to collect such royalties. 208 | 209 | 210 | Section 3 -- License Conditions. 211 | 212 | Your exercise of the Licensed Rights is expressly made subject to the 213 | following conditions. 214 | 215 | a. Attribution. 216 | 217 | 1. If You Share the Licensed Material (including in modified 218 | form), You must: 219 | 220 | a. retain the following if it is supplied by the Licensor 221 | with the Licensed Material: 222 | 223 | i. identification of the creator(s) of the Licensed 224 | Material and any others designated to receive 225 | attribution, in any reasonable manner requested by 226 | the Licensor (including by pseudonym if 227 | designated); 228 | 229 | ii. a copyright notice; 230 | 231 | iii. a notice that refers to this Public License; 232 | 233 | iv. a notice that refers to the disclaimer of 234 | warranties; 235 | 236 | v. a URI or hyperlink to the Licensed Material to the 237 | extent reasonably practicable; 238 | 239 | b. indicate if You modified the Licensed Material and 240 | retain an indication of any previous modifications; and 241 | 242 | c. indicate the Licensed Material is licensed under this 243 | Public License, and include the text of, or the URI or 244 | hyperlink to, this Public License. 245 | 246 | 2. You may satisfy the conditions in Section 3(a)(1) in any 247 | reasonable manner based on the medium, means, and context in 248 | which You Share the Licensed Material. For example, it may be 249 | reasonable to satisfy the conditions by providing a URI or 250 | hyperlink to a resource that includes the required 251 | information. 252 | 253 | 3. If requested by the Licensor, You must remove any of the 254 | information required by Section 3(a)(1)(A) to the extent 255 | reasonably practicable. 256 | 257 | 4. If You Share Adapted Material You produce, the Adapter's 258 | License You apply must not prevent recipients of the Adapted 259 | Material from complying with this Public License. 260 | 261 | 262 | Section 4 -- Sui Generis Database Rights. 263 | 264 | Where the Licensed Rights include Sui Generis Database Rights that 265 | apply to Your use of the Licensed Material: 266 | 267 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 268 | to extract, reuse, reproduce, and Share all or a substantial 269 | portion of the contents of the database; 270 | 271 | b. if You include all or a substantial portion of the database 272 | contents in a database in which You have Sui Generis Database 273 | Rights, then the database in which You have Sui Generis Database 274 | Rights (but not its individual contents) is Adapted Material; and 275 | 276 | c. You must comply with the conditions in Section 3(a) if You Share 277 | all or a substantial portion of the contents of the database. 278 | 279 | For the avoidance of doubt, this Section 4 supplements and does not 280 | replace Your obligations under this Public License where the Licensed 281 | Rights include other Copyright and Similar Rights. 282 | 283 | 284 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 285 | 286 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 287 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 288 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 289 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 290 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 291 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 292 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 293 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 294 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 295 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 296 | 297 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 298 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 299 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 300 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 301 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 302 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 303 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 304 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 305 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 306 | 307 | c. The disclaimer of warranties and limitation of liability provided 308 | above shall be interpreted in a manner that, to the extent 309 | possible, most closely approximates an absolute disclaimer and 310 | waiver of all liability. 311 | 312 | 313 | Section 6 -- Term and Termination. 314 | 315 | a. This Public License applies for the term of the Copyright and 316 | Similar Rights licensed here. However, if You fail to comply with 317 | this Public License, then Your rights under this Public License 318 | terminate automatically. 319 | 320 | b. Where Your right to use the Licensed Material has terminated under 321 | Section 6(a), it reinstates: 322 | 323 | 1. automatically as of the date the violation is cured, provided 324 | it is cured within 30 days of Your discovery of the 325 | violation; or 326 | 327 | 2. upon express reinstatement by the Licensor. 328 | 329 | For the avoidance of doubt, this Section 6(b) does not affect any 330 | right the Licensor may have to seek remedies for Your violations 331 | of this Public License. 332 | 333 | c. For the avoidance of doubt, the Licensor may also offer the 334 | Licensed Material under separate terms or conditions or stop 335 | distributing the Licensed Material at any time; however, doing so 336 | will not terminate this Public License. 337 | 338 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 339 | License. 340 | 341 | 342 | Section 7 -- Other Terms and Conditions. 343 | 344 | a. The Licensor shall not be bound by any additional or different 345 | terms or conditions communicated by You unless expressly agreed. 346 | 347 | b. Any arrangements, understandings, or agreements regarding the 348 | Licensed Material not stated herein are separate from and 349 | independent of the terms and conditions of this Public License. 350 | 351 | 352 | Section 8 -- Interpretation. 353 | 354 | a. For the avoidance of doubt, this Public License does not, and 355 | shall not be interpreted to, reduce, limit, restrict, or impose 356 | conditions on any use of the Licensed Material that could lawfully 357 | be made without permission under this Public License. 358 | 359 | b. To the extent possible, if any provision of this Public License is 360 | deemed unenforceable, it shall be automatically reformed to the 361 | minimum extent necessary to make it enforceable. If the provision 362 | cannot be reformed, it shall be severed from this Public License 363 | without affecting the enforceability of the remaining terms and 364 | conditions. 365 | 366 | c. No term or condition of this Public License will be waived and no 367 | failure to comply consented to unless expressly agreed to by the 368 | Licensor. 369 | 370 | d. Nothing in this Public License constitutes or may be interpreted 371 | as a limitation upon, or waiver of, any privileges and immunities 372 | that apply to the Licensor or You, including from the legal 373 | processes of any jurisdiction or authority. 374 | 375 | 376 | ======================================================================= 377 | 378 | Creative Commons is not a party to its public 379 | licenses. Notwithstanding, Creative Commons may elect to apply one of 380 | its public licenses to material it publishes and in those instances 381 | will be considered the “Licensor.” The text of the Creative Commons 382 | public licenses is dedicated to the public domain under the CC0 Public 383 | Domain Dedication. Except for the limited purpose of indicating that 384 | material is shared under a Creative Commons public license or as 385 | otherwise permitted by the Creative Commons policies published at 386 | creativecommons.org/policies, Creative Commons does not authorize the 387 | use of the trademark "Creative Commons" or any other trademark or logo 388 | of Creative Commons without its prior written consent including, 389 | without limitation, in connection with any unauthorized modifications 390 | to any of its public licenses or any other arrangements, 391 | understandings, or agreements concerning use of licensed material. For 392 | the avoidance of doubt, this paragraph does not form part of the 393 | public licenses. 394 | 395 | Creative Commons may be contacted at creativecommons.org. 396 | 397 | 398 | For more information, please see 399 | 400 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mac 开光指南(V2) 2 | 💻 一份新 macOS 快速食用方法,普适新 Mac 或重装系统。 3 | 4 | > 本指南基于 MBP 14寸 12.5 系统(**主**)和 MBP 13寸 11.4 系统。 5 | > 6 | > 系统和软件的更新频繁,本项目不一定及时更新,故操作界面或步骤会略有差别,但影响不大。 7 | > 8 | > 本指南涉及内容较广,请选择适合自己的操作。 9 | > 10 | > 请善用 TOC 目录导航内容,GitHub 中 `README.md` 左侧的按钮更方便。 11 | > 12 | > 本指南遵循许可协议 [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh)(请看[转载要求](https://shockerli.net/reprint-protocol)) 13 | > 14 | > 博客原文地址: https://shockerli.net/post/mac-initialize 15 | > 16 | > 长期更新地址: https://github.com/shockerli/mac-initialize 17 | > 18 | > 最后更新于 `2023-11-06` 19 | 20 | 21 | ## 应用安装 22 | ### 安装软件 23 | 24 | ### 软件下载途径 25 | - App Store 搜索或排行榜 26 | - 软件的官网,都会提供下载 27 | - 第三方网站(不一定安全,需自行甄别) 28 | 29 | 有一些软件,是没有上架应用商店(如搜狗输入法)、或应用商店里的是阉割版本(如柠檬清理),就需要去官网下载。 30 | 31 | 下载软件时,尽量选择与架构匹配的,不要选 `Universal`,因为 `Universal` 会同时包含两个架构的软件包,体积更大但却没啥用。以下图 VSCode 为例,如果是 M1/M2 等苹果芯片则选 `Apple Silicon`,反之则选 `Intel Chip`。 32 | 33 | ![vscode-select-mac-platform](assets/select-app-platform.jpg) 34 | 35 | 当然,目前绝大多数的软件是不支持这么选择的,也就是只提供了一个 `Universal` 通用版本,那安装后,电脑里就会多一个架构的软件,可以使用[柠檬清理](https://lemon.qq.com)进行查找清理掉,不影响正常使用。 36 | 37 | 38 | ### 桌面上的安装包图标怎么去除? 39 | - 方法①:桌面上右键安装包图标,选择「推出“XXX”」。 40 | 41 | ![移除桌面安装包镜像图标](assets/remove-desktop-icon.png) 42 | 43 | - 方法②:Finder(访达)左栏的「位置」处也有对应安装包,点按应用名称右侧的推出图标即可。 44 | 45 | - 方法③:重启系统后,安装包镜像会自动取消,对应的图标也会自动消失。 46 | 47 | 48 | ### 关闭软件更新 49 | 为何要关闭软件更新?因为默认会自动下载更新,也就会偷偷跑流量,而苹果系统更新都是几个G起步。不信看看 `/Library/Updates` 目录有多大。 50 | 51 | 关闭自动更新: 52 | - `系统偏好设置 → 软件更新 → 自动保持我的 Mac 运行最新版本(取消勾选)` 53 | - `系统偏好设置 → 软件更新 → 高级... → 取消所有勾选`(主要是**下载可用的更新**) 54 | - `App Store → 偏好设置 → 自动更新(取消勾选)、自动下载站其他设备上购买的App(取消勾选)` 55 | 56 | 删除已下载的文件: 57 | - 关闭 `SIP`、删除目录 `/Library/Updates` 下的内容、再开启 `SIP`。 58 | 59 | 进程 `nsurlsessiond` 会偷偷跑流量,有几个原因: 60 | - 正在下载系统或软件更新文件 61 | - iCloud 正在同步数据 62 | 63 | 64 | 65 | ## 键盘符号与快捷键 66 | ### 符号映射 67 | | 符号 | 按键 | 68 | | --- | --- | 69 | | ⌘ | Command | 70 | | ⇧ | Shift | 71 | | ⇪ | Caps Lock | 72 | | ⌥ | Option = Alt | 73 | | ⌃ | Control | 74 | | Fn | 功能键 | 75 | | ↩ | Enter | 76 | | ⌫ | Delete | 77 | | ⌦ | Fn + Delete | 78 | | ↑ | 上箭头 | 79 | | ↓ | 下箭头 | 80 | | ← | 左箭头 | 81 | | → | 右箭头 | 82 | | ⇞ | Fn + ↑ = Page Up | 83 | | ⇟ | Fn + ↓ = Page Down | 84 | | Home | Fn + ← | 85 | | End | Fn + → | 86 | | ⇥ | Tab = 右制表符 | 87 | | ⇤ | Shift + Tab = 左制表符 | 88 | | ⎋ | Esc = Escape | 89 | | ⏏ | 电源开关键 | 90 | | ` | 反引号(ESC 下面) | 91 | 92 | 93 | 94 | 一定要熟记前 5 个符号的按键位置!!! 95 | 96 | 97 | ### 常用快捷键 98 | 大部分情况下,Command 键等同于 Windows 的 Ctrl 键,以下仅列出部分常用或与 Windows 不一样的快捷键,更多参考官方 [Mac 键盘快捷键](https://support.apple.com/zh-cn/HT201236) 以及对应软件的快捷键。 99 | 100 | | 快捷键 | 说明 | 101 | | --- | --- | 102 | | Command + Z | 撤销,`Shift + Command + Z`:重做 | 103 | | Command + 逗号 (`,`) | 打开当前窗口应用的**偏好设置** | 104 | | Control + Command + Q | 立即锁定屏幕 | 105 | | Command + D | 复制所选文件 | 106 | | Option + Command + D | 显示或隐藏“程序坞” | 107 | | Control + Command + D | 显示或隐藏所选字词的定义 | 108 | | Control + A | 移至行或段落的开头 | 109 | | Control + E | 移至行或段落的末尾 | 110 | | Control + U | 终端软件里,直接清除行 | 111 | | Control + 空格 | 切换输入法 | 112 | | Command + Q | 退出当前应用 | 113 | 114 | - 访达 115 | 116 | | 快捷键 | 说明 | 117 | | --- | --- | 118 | | Command + 上箭头 | 打开包含当前文件夹的文件夹 | 119 | | Command + 左中括号 (`[`) | 前往上一文件夹 | 120 | | Command + 右中括号 (`]`) | 前往下一个文件夹 | 121 | | Command + Delete | 将所选项移到废纸篓 | 122 | | Option + Command + C | 复制当前目录的全路径 | 123 | 124 | - 窗口 125 | 126 | | 快捷键 | 说明 | 127 | | --- | --- | 128 | | Command + Tab | 在多个打开的 App 之间切换到**下一个**最近使用的 App | 129 | | Command + Shift + Tab | 在多个打开的 App 之间切换到**上一个**最近使用的 App | 130 | | Command + `(反引号) | 同一个应用的不同窗口间切换,已被最小化的窗口无法恢复 | 131 | | Command + M | 最小化当前窗口,但无法通过快捷键切换回来,只能手动去菜单栏或程序坞重新打开 | 132 | | Command + H | 隐藏当前应用,即该应用的所有窗口,可通过快捷键切换回来 | 133 | | Command + Option + H | 隐藏其他应用 | 134 | | F3 | 显示当前桌面的所有已打开窗口(不含最小化或已隐藏) | 135 | | Control + 上箭头 | 同上 | 136 | | 触控板:四指向上轻扫 | 同上(如已设置`触控板 → 更多手势 → 调度中心`) | 137 | | Control + 下箭头 | 显示当前应用的所有已打开窗口(不含最小化或已隐藏) | 138 | | 触控板:四指向下轻扫 | 同上(如已设置`触控板 → 更多手势 → App Expose`) | 139 | 140 | - 桌面 141 | 142 | | 快捷键 | 说明 | 143 | | --- | --- | 144 | | Control + 右箭头 | 向右切换桌面 | 145 | | 触控板:四指向右轻扫 | 同上 | 146 | | Control + 左箭头 | 向左切换桌面 | 147 | | 触控板:四指向左轻扫 | 同上 | 148 | 149 | 150 | 其他快捷键:选取苹果菜单 > “系统偏好设置”,点按“键盘”,然后点按“快捷键”。 151 | 152 | 153 | ## 基础设置 154 | 155 | ### 触控板设置 156 | 触控板的设置及使用教程,可查看 `系统偏好设置 > 触控板`。 157 | 158 | > 让你的触控板变的跟鼠标不同,治疗你的手指关节炎😄 159 | 160 | - `系统偏好设置 > 触控板 > 光标与点按` 161 | * `轻点来点按(勾选)` 162 | * 可单指轻点=鼠标左键点击,可双指轻点=鼠标右键点击 163 | 164 | - `系统偏好设置 > 触控板 > 光标与点按` 165 | * `查询与数据检测器(勾选)` 166 | * `三指轻点` 167 | * 对着词汇三指轻点,直接调用Mac自带词典查询,与右键中的「查询」一样 168 | 169 | - `系统偏好设置 > 触控板 > 更多手势` 170 | * `App Expose(勾选)` 171 | * `在全屏幕显示的App之间轻扫(四指左右轻扫)` 172 | * 以上两个选项,将三指操作改为四指操作,是为了给「三指拖移」让路 173 | 174 | - `系统偏好设置 > 辅助功能 > 指针控制 > 鼠标与触控板 > 触控板选项` 175 | * `启动拖移(勾选)> 三指拖移` 176 | * 与鼠标左键按住拖动一样,三个手指同时在触控板滑动,可拖动任何窗口的菜单栏进行移动,也可以选择范围内容 177 | 178 | 学习触控板设置中的各个手势操作示范视频,别再跟鼠标一样用触控板啦。 179 | 180 | 181 | ### 开启任何来源 182 | 为何要「任何来源」权限?因为不开启就无法安装 `App Store` 以外的软件,比如从网站直接下载的 dmg 安装包。 183 | 184 | `被认可的开发者` 指的是购买了苹果企业证书对应用进行签名、且提交给苹果审核通过的软件。而大部分免费开源的应用是不会去购买此证书的。另外,破解应用因为会修改应用的文件从而导致签名失效而无法运行。所以,想安装第三方应用,需要开启 `任何来源` 这个权限。 185 | 186 | `macOS` 默认隐藏了 `任何来源` 选项,需要在终端执行以下命令显示此选项: 187 | 188 | ```shell 189 | sudo spctl --master-disable 190 | ``` 191 | 192 | 然后在 `系统偏好设置 > 安全性与隐私 > 通用 > 任何来源` 打开: 193 | 194 | ![install-any-source-app](assets/install-any-source-app.jpg) 195 | 196 | 197 | 198 | ### 修改主机名 199 | > 就是为了好看点,默认的太丑,隔空投送的显示名字和终端都会用到 200 | 201 | 参考文章: https://shockerli.net/post/macos-hostname-scutil/ 202 | 203 | 设置路径:`系统偏好设置 > 共享` => 修改`电脑名称`、编辑`本地主机名` 204 | 205 | 也可通过命令修改: 206 | 207 | ```shell 208 | # 修改主机名 209 | sudo scutil --set HostName 自定义主机名 210 | 211 | # 修改电脑名称 212 | sudo scutil --set ComputerName 自定义电脑名 213 | ``` 214 | 215 | 216 | ### 拼写辅助 217 | 当你输入英文单词时,默认会提示你更正首字母为大写,烦人的很。 218 | 219 | `系统偏好设置 > 键盘 > 文本 > 自动大写字词的首字母(取消勾选)` 220 | 221 | 同理,如果不想「自动纠正拼写」或其他输入相关的功能,也可在此面板一并调整。 222 | 223 | 224 | ### 程序坞(Dock) 225 | ![mac-icon-dock](assets/mac-icon-dock.png) 226 | 227 | `程序坞(Dock)` 是 macOS 桌面上日常 APP 和功能的便利管理,与 `Windows` 任务栏类似。 228 | 229 | `系统偏好设置 > 程序坞与菜单栏 > 程序坞` 230 | - `> 将窗口最小化至应用程序图标(勾选)` 231 | - `> 在程序坞中显示最近使用的应用程序(取消勾选)` 232 | 233 | 234 | 从程序坞中挨个移除你不行要的应用图标,以及添加你希望常驻的图标。 235 | 236 | **移除**:`右键程序坞中应用图标 > 选项 > 从程序坞中移除` 237 | 238 | 或者将程序坞中的图标拖到废纸篓中也能删除图标。 239 | 240 | ![移除程序坞图标](assets/remove-dock-icon.png) 241 | 242 | **添加**:从启动台(应用全列表)拖动图标到程序坞指定位置 243 | 244 | 245 | ### 显示器 246 | 247 | #### 夜览 248 | 夜览与 [f.lux](https://justgetflux.com) 功能类似,根据时间来自动调节显示器色温的护眼程序。不过系统自带夜览只支持内置显示器,外接显示器不会生效,此时可关闭夜览并使用 `f.lux`。 249 | 250 | ``` 251 | 系统偏好设置 > 显示器 > 夜览... > 设定时间 > 日落到日出 252 | ``` 253 | 254 | 255 | ### 菜单栏 256 | ![mac-icon-menu](assets/mac-icon-menu.png) 257 | 258 | 菜单栏中的系统图标尽量少一点,多留空间给应用图标,尤其是小屏、刘海屏。 259 | 260 | #### 时钟 261 | 默认时间格式太长,去除不必要的。 262 | 263 | ``` 264 | 系统偏好设置 > 程序坞与菜单栏 > 时钟 > 显示日期(取消勾选)、显示星期(取消勾选)、在时间中显示秒钟(勾选) 265 | ``` 266 | 267 | #### 聚焦 268 | 不需要在菜单栏展示,有快捷键 `⌘ + 空格`。 269 | 270 | ``` 271 | 系统偏好设置 > 程序坞与菜单栏 > 聚焦 > 在菜单栏中显示(取消勾选) 272 | ``` 273 | 274 | #### Siri 275 | 不需要在菜单栏展示,可配置快捷键或语音指令。 276 | 277 | `系统偏好设置 > Siri`,自行配置「听取“嘿Siri”」、快捷键等。 278 | 279 | 280 | ### 访达(Finder) 281 | ![mac-icon-finder](assets/mac-icon-finder.png) 282 | 283 | `访达(Finder)` 是 macOS 中文件可视化管理程序。 284 | - `访达 → 偏好设置 → 通用 → 开启新“访达”窗口时打开:「下载」` 285 | 286 | 设置一个访达启动时的默认打开目录。 287 | 288 | - `访达 → 偏好设置 → 通用 → 在标签页中打开文件夹(勾选)` 289 | 290 | 开启多标签页功能。 291 | (旧版系统不支持,可自行安装 `Path Finder` 或 `TotalFinder` 以使用该功能) 292 | 293 | - `访达 → 偏好设置 → 高级 → 执行搜索时:「搜索当前文件夹」` 294 | 295 | 默认是搜全电脑文件,但绝大多数我们期望的是搜索当前文件夹下的文件。 296 | 297 | - 开启 `退出访达` 功能 298 | 299 | 一般都应用都能退出(`⌘ + Q`),但访达默认是不行的,需手动开启。 300 | 301 | ```shell 302 | defaults write com.apple.finder QuitMenuItem -bool true 303 | 304 | killall Finder 305 | ``` 306 | 307 | - 显示目录全路径 308 | 309 | `Finder` 顶栏默认显示的是当前目录的名称,如需跟 Windows 一样显示全路径,需手动开启。 310 | 311 | ```shell 312 | defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 313 | 314 | killall Finder 315 | ``` 316 | 317 | 318 | ### 服务 319 | `服务` 是 macOS 中服务提供者程序为服务请求者程序提供的便捷服务(便捷入口、且支持设置快捷键)。 320 | 321 | 例如,`iTerm` 就在 `Finder` 322 | 323 | ``` 324 | 系统偏好设置 → 键盘 → 快捷键 → 服务 325 | ``` 326 | 327 | 可开启所需服务,及设置其快捷键。 328 | 329 | 330 | ### 密码长度限制 331 | macOS 10.14 后不允许设置 4 位数以下的密码。下面的命令可关闭这个策略的限制: 332 | 333 | ```shell 334 | pwpolicy -clearaccountpolicies 335 | ``` 336 | 337 | 338 | ### 开机自启管理 339 | 用户级别的开机自启应用管理,可在 `系统偏好设置 → 用户与群组 → 登录项` 列表中查看和开关。 340 | 341 | 系统级别的,比如 `Docker`,可用 `柠檬清理` 等系统工具进行管理。 342 | 343 | 如果是通过 `Homebrew` 安装的服务,那可用 `brew services` 命令管理。 344 | 345 | 也可以通过命令 `launchctl` 进行管理。 346 | 347 | 348 | ### 关闭输入法切换时的提示图标 349 | > 自 macOS 14 Sonoma 开始,默认会在切换输入法时,光标处有个提示图标。 350 | > 351 | > 在终端类软件中,执行以下指令,并按提示输入电脑密码,然后重启电脑后关闭该提示。 352 | 353 | ```shell 354 | sudo defaults write /Library/Preferences/FeatureFlags/Domain/UIKit.plist redesigned_text_cursor -dict-add Enabled -bool NO 355 | ``` 356 | 357 | 358 | ### 关于 SIP 359 | SIP(`System Integrity Protection`,系统完整性保护)是 macOS 所采用的一项安全技术,能够帮助防止潜在恶意软件修改 macOS 上受保护的文件和文件夹。系统完整性保护可以限制 `root` 用户帐户,以及 `root` 用户能够在 macOS 的受保护部分完成的操作。 360 | 361 | 为了安全,**强烈不建议**关闭 `SIP` 保护。 362 | 363 | 如果一个应用需要关闭 SIP 才可运行,这意味着此应用本身也不安全,可直接放弃。 364 | 365 | 如果是临时性的需要(如上文提到的删除系统更新文件),可以先关闭、操作完后再立即开启。 366 | 367 | 368 | 369 | ## 基础设施 370 | ### Xcode Command Line Tools 371 | > macOS 系统很多软件都需要用到的依赖工具,不安装的话连 Git 都没法用🙄 372 | 373 | ```shell 374 | xcode-select --install 375 | ``` 376 | 377 | 同意协议后会全程自动下载安装,文件比较大,需要等待一会。 378 | 379 | ![install-xcode-select](assets/install-xcode-select.png) 380 | 381 | 382 | ### Homebrew 383 | 开源免费、强大易用的软件安装管理器。 384 | 385 | 官网: https://brew.sh 386 | 387 | GitHub: https://github.com/Homebrew/brew 388 | 389 | 390 | 因国内访问 GitHub 不稳定,可以直接参考清华大学镜像站的安装教程,简单快速、此处不做复述。 391 | 392 | 清华大学开源软件镜像站及安装、镜像教程: https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/ 393 | 394 | 395 | 396 | ### iTerm2 397 | 开源免费、美观高效的最强终端工具。 398 | 399 | 官网下载: https://www.iterm2.com 400 | 401 | 或 `brew install --cask iterm2` 402 | 403 | 404 | #### 颜色配置 405 | 颜色列表: https://iterm2colorschemes.com 406 | 407 | 颜色选择: `Profiles -> Colors -> Color Presets` 选择 `Solarized Dark` 408 | 409 | 410 | #### 背景图 411 | `Profiles → Default → Window → Background Image → Enabled(勾选,会弹窗让选择图片` 412 | 413 | 还可调节透明度、缩放模式。 414 | 415 | 416 | #### Profiles Command 417 | `Profiles` 用于配置新建 Tab 的默认行为,而 `Profiles` 中的 Command 则可用于配置新建 Tab 时自动执行的命令,一般用于 SSH 远程连接的场景较多。 418 | 419 | Profiles Command 配置: 420 | 421 | ![iTerm2 Profiles Command 配置](assets/iterm-profile-setting.jpg) 422 | 423 | 注意:自定义的 Profile 会继承 `Default` 的配置,故自定义的 Profile 无需重复去配置颜色、主题、快捷键等。 424 | 425 | Profiles 使用及快捷键: 426 | 427 | ![iTerm2 Profiles 使用及快捷键](assets/iterm-profile-usage.jpg) 428 | 429 | 430 | #### Status Bar 431 | 432 | 433 | #### 配置左右键前后单词跳转 434 | > 按住 `option + → or ←` 键,在命令的开始和结尾跳转切换 435 | 436 | `Profiles → Default → Keys → Key Mappings`,点击 `+`: 437 | 438 | `Keyboard shortcut`: `option + →` 439 | `Action`: `Send Escape Sequence` 440 | `Esc + f` 441 | 442 | `Keyboard shortcut`: `option + ←` 443 | `Action`: `Send Escape Sequence` 444 | `Esc + b` 445 | 446 | 447 | #### iTerm2 快速隐藏和显示 448 | `Keys → Hotkey`,勾选 `Show/hide all windows with a system-wide hotkey`,并设置快捷键,比如 `⌥ + ⌘ + .`(`option + command + 句点`)。 449 | 450 | 451 | #### 在 Finder 中打开当前目录 452 | 在终端中使用 `open` 命令即可: 453 | ```shell 454 | open . 455 | ``` 456 | 457 | #### 粘贴自动转义 458 | 从剪切板粘贴 URL 到 iTerm2 时会被转义。参考官方 [Wiki](https://github.com/ohmyzsh/ohmyzsh/wiki/Settings#disable_magic_functions)。打开配置文件 `~/.zshrc`: 459 | ```ini 460 | DISABLE_MAGIC_FUNCTIONS=true 461 | ``` 462 | 463 | #### Finder 中使用 iTerm 打开当前目录 464 | 可在 Finder 中快捷的使用 iTerm 打开当前目录,避免手动的在 iTerm 中输入路径。 465 | 466 | ``` 467 | Finder → 文件右键 → 服务 → New iTerm2 Tab Here 468 | ``` 469 | 470 | 471 | ### Oh My Zsh 472 | `Oh My Zsh` 让 `zsh` 变得更好用、配置更简单。(macOS 10.15 后已使用 `zsh` 作为默认 Shell) 473 | 474 | GitHub: https://github.com/ohmyzsh/ohmyzsh 475 | 476 | - 通过`curl`安装 477 | 478 | ```shell 479 | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 480 | ``` 481 | 482 | - 设置 `zsh` 为当前用户的默认 `Shell` 483 | 484 | ```shell 485 | chsh -s /bin/zsh 486 | ``` 487 | 488 | - 配置文件 489 | 490 | ```shell 491 | .zshenv 中存放的环境变量配置项在任何场景下都能被读取,这里通常把$PATH等变量写在这里,这样无论是在交互 shell,或者运行程序都会读取此文件 492 | 493 | .zshrc 主要用在交互 shell,上篇文章中就是对这个文件进行修改。对终端交互shell有用。 494 | 495 | .zlogin 在 login shell 的时候读取,比如系统启动的时候会读取此文件 496 | 497 | .zprofile 是.zlogin的替代品,如果使用了 .zlogin 就不必再关心此文件 498 | 499 | .zlogout退出终端的时候读取,用于做一些清理工作 500 | 501 | 读取顺序 502 | .zshenv → [.zprofile if login] → [.zshrc if interactive] → [.zlogin if login] → [.zlogout sometimes] 503 | ``` 504 | 505 | 506 | #### 配置 507 | - 禁用自动更新 508 | 509 | 默认会每次新开 Tab 时检查更新,编辑 `~/.zshrc`,取消该行内容的注释: 510 | 511 | ```shell 512 | zstyle ':omz:update' mode disabled 513 | ``` 514 | 515 | #### 插件 516 | 517 | ##### zsh-autosuggestions 518 | > 输入命令时可提示自动补全(灰色部分),按键 `→` 即可补全 519 | > 520 | > https://github.com/zsh-users/zsh-autosuggestions 521 | 522 | 通过 Brew 安装: 523 | ```shell 524 | brew install zsh-autosuggestions 525 | ``` 526 | 527 | 安装完后,根据提示,打开 `~/.zshrc` 添加: 528 | ```shell 529 | // 以下内容可能 Homebrew 版本不一样,以 brew 的提示为准 530 | // 比如以前是 /usr/local/share/xxx 531 | // 可直接用 brew info zsh-autosuggestions 查看 532 | source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh 533 | ``` 534 | 535 | 536 | ##### zsh-syntax-highlighting 537 | > 日常用的命令会高亮显示,命令错误显示红色 538 | > 539 | > https://github.com/zsh-users/zsh-syntax-highlighting 540 | 541 | 通过 Brew 安装: 542 | ```shell 543 | brew install zsh-syntax-highlighting 544 | ``` 545 | 546 | 安装完后,根据提示,打开 `~/.zshrc` 添加: 547 | ```shell 548 | // 以下内容可能 Homebrew 版本不一样,以 brew 的提示为准 549 | // 比如以前是 /usr/local/share/xxx 550 | // 可直接用 brew info zsh-syntax-highlighting 查看 551 | source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 552 | ``` 553 | 554 | ##### autojump 555 | > 实现目录间快速跳转,想去哪个目录直接 `j + 目录名` 556 | > 557 | > https://github.com/wting/autojump 558 | 559 | 通过 Brew 安装: 560 | ```shell 561 | brew install autojump 562 | ``` 563 | 564 | 安装完后,根据提示,打开 `~/.zshrc` 添加: 565 | ```shell 566 | [ -f /opt/homebrew/etc/profile.d/autojump.sh ] && . /opt/homebrew/etc/profile.d/autojump.sh 567 | ``` 568 | 569 | 570 | #### 主题 571 | 主题列表: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes 572 | 573 | 内置主题: `$ZSH/themes`(`$HOME/.oh-my-zsh/themes`) 574 | 575 | 修改 `~/.zshrc` 配置文件: 576 | 577 | ```shell 578 | ZSH_THEME="robbyrussell" 579 | ``` 580 | 581 | 可在 `$ZSH/custom/themes` 下自定义主题。 582 | 583 | 584 | ### Git 585 | #### GitHub 配置 SSH 586 | 终端执行命令 `ssh-keygen`,一路回车,生成密钥。 587 | 588 | 读取并拷贝密钥文本。 589 | ```shell 590 | cat ~/.ssh/id_rsa.pub 591 | ``` 592 | 593 | 打开 [GitHub](https://github.com/settings/ssh/new) SSH key 配置页面(`个人头像 > Settings > Access > SSH and GPG keys > New SSH Key`),将拷贝的 `ssh-rsa` 密钥内容添加到 GitHub。 594 | 595 | 596 | #### Git 配置 user 597 | 终端执行命令 `git config --global -e` 打开 Git 全局配置文件,修改或添加 `[user]` 内容: 598 | ```ini 599 | [user] 600 | name = jioby 601 | email = jioby@example.com 602 | ``` 603 | 604 | 或者使用命令行方式: 605 | ```shell 606 | git config --global user.name "jioby" 607 | git config --global user.email "jioby@example.com" 608 | ``` 609 | 610 | 611 | #### 设置 lg 别名 612 | `git config --global -e` 打开配置文件: 613 | ```ini 614 | [alias] 615 | lg = log --graph --pretty=format:'%Cred%h%Creset | %ad | %Cblue%d%Creset %s %Cgreen(%an)%Creset' --abbrev-commit --date=short 616 | ``` 617 | 618 | 或者使用命令行方式: 619 | ```shell 620 | git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset | %ad | %Cblue%d%Creset %s %Cgreen(%an)%Creset' --abbrev-commit --date=short" 621 | ``` 622 | 623 | 接着可使用 `git lg` 清爽看日志: 624 | ```shell 625 | * 5864617 | 2022-07-31 | (HEAD -> master, origin/master, origin/HEAD) update license to CC 4.0 (Jioby) 626 | * 3d8de53 | 2022-07-31 | 关闭自动更新,解决nsurlsessiond偷偷跑流量 (shockerli) 627 | * a0c313e | 2022-07-30 | vscode install code command (shockerli) 628 | * 8ebffa3 | 2022-07-30 | 全新指南,支持macOS 12.x系统 (shockerli) 629 | ``` 630 | 631 | #### 默认分支 632 | 设置 Git 项目初始化时的默认分支,一般为 `master` 或 `main`。 633 | 634 | ```shell 635 | git config --global init.defaultBranch 636 | ``` 637 | 638 | 639 | ### Vim 640 | 在 macOS 上 `Vim` 使用较浅,故配置够用即可,不装扩展。直接 `vim ~/.vimrc`: 641 | 642 | ```vim 643 | " 推荐设置 644 | colorscheme desert " 颜色显示方案 645 | syntax on " 打开语法高亮 646 | set tabstop=4 " TAB 字符的显示宽度 647 | 648 | " 以下自选 649 | set nocompatible " 不兼容 Vi 650 | set nu " 显示行号 651 | set showmatch " 自动高亮匹配括号 652 | set cursorline " 高亮光标所在行 653 | set hlsearch " 高亮搜索匹配结果 654 | set incsearch " 跟随输入,即时搜索 655 | set ignorecase " 搜索忽略大小写 656 | set history=1000 " 历史操作记录次数 657 | set autoread " 文件发生外部变更时提示 658 | set wildmenu " 命令模式,底部按 Tab 自动补全 659 | set smartindent " 智能缩进 660 | set expandtab " 按 Tab 键时,使用空格替代制表符(不影响已有制表符) 661 | set shiftwidth=4 " 自动缩进时,缩进长度 662 | set softtabstop=-1 " Tab 转为多少空格,负数表示与shiftwidth一致 663 | set laststatus=2 " 是否显示状态栏, 0:不显示, 1:多窗口时显示, 2:显示 664 | set ruler " 这状态栏显示光标的当前位置(行数&列数) 665 | set wrap " 自动换行 666 | ``` 667 | 668 | `colorscheme` 可选项在 `/usr/share/vim/vim*/colors` 目录下,自己选。 669 | 670 | 671 | 672 | ## 系统工具 673 | 674 | ### 柠檬清理 675 | > 腾讯出品**开源免费**的清理、卸载、流量、监控、磁盘空间分析、开机启动管理等系统工具。 676 | 677 | 官网下载: https://lemon.qq.com 678 | 679 | 开源地址: https://github.com/Tencent/lemon-cleaner 680 | 681 | 最值得使用的功能,莫过于**清理与当前芯片不同版本的二进制文件**: 682 | ![lemon-clean-rosetta](assets/lemon-clean-rosetta.jpg) 683 | 684 | 685 | ### 输入法 686 | 拼音输入法推荐 `搜狗输入法`,简单易用、词库齐全、安装即用。 687 | 688 | 官网下载: https://pinyin.sogou.com/mac/ 689 | 690 | 输入法配置:`系统偏好设置 > 键盘 > 输入法`:删除无用的输入法(`ABC` 别删) 691 | 692 | 同步原配置:`偏好设置 > 登录账户 > 同步 > 配置同步 > 下载配置` 693 | 694 | 695 | ### Chrome 696 | 官网下载: https://www.google.cn/intl/zh-CN/chrome/ 697 | 698 | #### 扩展 699 | - [Infinity New Tab Pro](http://cn.infinitynewtab.com): 新标签页 700 | - [iTab New Tab](https://www.itab.link): 新标签页 701 | - [FeHelper](https://www.baidufe.com/fehelper): 前端工具集(内含 JSON 美化对比、时间转换、编码转换等十几个小工具) 702 | - [Adblock Plus](https://adblockplus.org): 广告净化 703 | - [SimpRead](http://ksria.com/simpread): 最佳阅读体验 704 | - [Tampermonkey](https://www.tampermonkey.net): 油猴脚本管理 705 | - [ImageAssistant](http://www.pullywood.com/ImageAssistant): 图片助手,网页图片提取下载 706 | - [SourceGraph](https://sourcegraph.com): GitHub 源码浏览神器 707 | 708 | 709 | #### 油猴脚本 710 | 油猴脚本(用户脚本)是一段代码,它们能够优化您的网页浏览体验。安装之后,有些脚本能为网站添加新的功能,有些能使网站的界面更加易用,有些则能隐藏网站上烦人的部分内容。 711 | 712 | [Tampermonkey](https://www.tampermonkey.net) 是一个可运行在 Chrome、Firefox、Safari、Edge 等浏览器的用户脚本管理扩展。 713 | 714 | [Greasy Fork](https://greasyfork.org) 则是一个油猴脚本免费商店,绝大部分用户脚本都在上面有发布,方便查找、安装使用。 715 | 716 | **安装方式**: 717 | - 从 Greasy Fork 安装 718 | 例如 [CSDNGreener](https://greasyfork.org/zh-CN/scripts/378351),打开后会显示安装按钮和界面 719 | - 从 URL 安装 720 | 例如 Bilibili-Evolved 的脚本 URL 是 https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/dist/bilibili-evolved.user.js 721 | 直接在 Tampermonkey `管理面板 > 实用工具 > 从 URL 安装`,粘贴脚本 URL,点击安装即可 722 | 723 | **推荐脚本**: 724 | - [Bilibili-Evolved](https://github.com/the1812/Bilibili-Evolved) - B站增强 [[脚本 URL]](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/dist/bilibili-evolved.user.js) 725 | - [CSDNGreener](https://github.com/adlered/CSDNGreener) - CSDN 网站绿化 [[Greasy Fork]](https://greasyfork.org/zh-CN/scripts/378351) 726 | 727 | 728 | 729 | ### Alfred 730 | 效率工具神器,可以快速的搜索本地应用、搜索本地文件、执行终端命令、浏览器搜索、打开网址、剪切板管理、翻译、文件管理、音乐控制等,也可以自定义工作流,与其他软件深度配合。 731 | 732 | 软件小巧、性能强悍、高级功能需付费,配置同步可用 iCloud 或 Git 或自己想办法。 733 | 734 | 官网: https://www.alfredapp.com 735 | 736 | #### 常用配置 737 | - `Features` > `Web Search` > 新增自定义搜索、关闭不需要的搜索 738 | - `Features` > `Default Results` > `Setup fallback results` > 设置使用搜索方式 739 | - `Features` > `Clipboard History` > 勾选需要剪贴板存储的内容(文本、图片、文件)及保留时间 740 | - `Appearance` > 选择 `Alfred macOS` 切换主题样式,也可以自定义 741 | - `Appearance` > `Options` > `Show Alfred on`:选择 `active screen` 或 `mouse screen`,因为默认为 `default screen` 即在默认显示屏打开 Alfred 窗口,多屏或多显示器时默认设置不够贴心。 742 | 743 | #### Workflows 744 | 可参考下面两个收藏集合内的配置: 745 | - [learn-anything/alfred-workflows](https://github.com/learn-anything/alfred-workflows) 746 | - [zenorocha/alfred-workflows](https://github.com/zenorocha/alfred-workflows) 747 | 748 | 749 | 750 | ### Shell Alias 751 | 以下是常用命令,设置别名,使用更方便。添加到 `~/.zshrc`。 752 | ```shell 753 | alias ll='ls -Alh' 754 | alias al='ls | sed "s:^:`pwd`/:"' 755 | alias egrep='ps -ef | grep' 756 | alias grep='grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}' 757 | ``` 758 | 759 | 760 | 761 | ### autossh 762 | > 一个简单管理远程 SSH 账号的脚本工具 763 | 764 | - 安装 765 | ```shell 766 | curl -o /usr/local/bin/autossh https://raw.githubusercontent.com/FeeiCN/autossh/master/autossh 767 | chmod +x /usr/local/bin/autossh 768 | ``` 769 | 770 | - 配置 771 | ```shell 772 | $ cat ~/.autosshrc 773 | server_name|192.168.1.110|root|password|port|is_bastion 774 | ``` 775 | 776 | ### 开发软件 777 | - `SourceTree`: Git 可视化(免费) 778 | - `Navicat Premium`: 多种数据库管理工具 779 | - `Sourcetrail`: 源码阅读神器([开源](https://github.com/CoatiSoftware/Sourcetrail)) 780 | - `Jetbrains IDE 系列` 781 | - `Postman`: 接口调试(免费) 782 | - `htop`: 增强版 `top` 命令([开源](https://github.com/htop-dev/htop)) 783 | - `Visual Studio Code`: 强大的编辑器([开源](https://code.visualstudio.com)) 784 | - `Proxyman`: 代理抓包工具(免费) 785 | 786 | 787 | #### Visual Studio Code 788 | 官网下载: https://code.visualstudio.com 789 | 790 | 791 | ##### 配置终端 code 快捷打开 792 | 安装 `code` 命令,支持在终端快捷打开 `VSCode`。 793 | 794 | 快捷键 `⌘ + ⇧ + P` 打开命令面板,输入 `shell`,选择 `Shell Command: Install 'code' command in PATH`。 795 | 796 | ![install-code-command-in-path](assets/install-code-in-path.jpg) 797 | 798 | 然后在终端输入 `code .` 或者 `code [path]` 直接在 `VSCode` 打开文件或目录。 799 | 800 | 801 | ##### 扩展 802 | | 扩展 | 说明 | 803 | | --- | --- | 804 | | `Chinese Language Pack for Visual Studio Code` | 中文语言包 | 805 | | `IntelliJ IDEA Keybindings` | IntelliJ IDEA 快捷键绑定 | 806 | | `Code Runner` | 快捷运行代码文件 | 807 | | `EditorConfig for VS Code` | `EditorConfig` 配置扩展,根据配置统一格式化风格 | 808 | | `PPZ` | 关系型数据库图形管理 | 809 | 810 | 811 | #### Sublime Text 812 | 安装 `Package Control`: https://packagecontrol.io/installation 813 | 814 | 中文插件: `ChineseLocalizations` 815 | 816 | - 配置 `subl` 命令行打开文件 817 | 818 | > 在 `~/.zshrc` 添加如下配置: 819 | 820 | ```shell 821 | alias subl="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'" 822 | ``` 823 | 824 | 然后就可以使用 `subl [path]` 快捷打开文件或目录。 825 | 826 | 827 | ### 其他软件 828 | - [`f.lux`](https://justgetflux.com):自动调整屏幕色温的护眼程序(免费) 829 | - `MonitorControl`:[`开源`](https://github.com/MonitorControl/MonitorControl) 显示器亮度、音量控制,支持外接显示器 830 | - `万年历`:日历(免费) 831 | - `网易有道词典`:翻译(免费) 832 | - `iShot`:截图、长截图、录屏(基础免费) 833 | - `嘀嗒清单`:时间与日程管理(基础免费) 834 | - `MWeb` / `Typora` / `FSNotes`:Markdown 笔记管理 835 | - `FastZip/MacZip`:解压缩(免费) 836 | - `NTFS Disk by Omi`:免费的 NTFS 磁盘读写管理器(支持 M1) 837 | - `OmniGraffle Pro`:图表/流程图等矢量图绘制 838 | - `Reeder`:RSS 订阅 839 | - `IINA`:[`开源`](https://github.com/iina/iina)音视频播放器 840 | - `Beyond Compare`:文件/文本对比 841 | - `Rectangle` - [`开源`](https://github.com/rxhanson/Rectangle)窗口整理/分屏 842 | - `uTools`:类似 Alfred 的效率工具,跨平台(免费) 843 | - `Brave Browser`:基于 `Chromium` 的[`开源`](https://github.com/brave/brave-browser)浏览器,号称能更好的保护隐私 844 | - `Bitwarden`:[`开源`](https://github.com/bitwarden/clients) 密码管理器 845 | - `Maccy`:[`开源`](https://github.com/p0deje/Maccy)剪切板管理工具 846 | - [`FlyKey`](https://www.better365.cn/FlyKey.html) - 应用快捷键展示(免费) 847 | - `Parallels Desktop` - 虚拟机 848 | - `AlDente` - 电源管理,让电池更耐用(基础免费) 849 | - [warp](https://github.com/warpdotdev/Warp) - 号称下一代终端神器(免费) 850 | - `Bartender` - 菜单栏图标管理 851 | 852 | 还有很多优秀软件没有推荐,后续单开一个专门介绍。 853 | 854 | 855 | ## 开发环境 856 | 857 | ### Java 858 | #### JDK 859 | - `JVM`:`Java Virtual Machine` 860 | - `JRE`:`Java Runtime Environment` 861 | - `JDK`:`Java SE Development Kit` 862 | - `SDK`:`Software Development Kit` 863 | 864 | ``` 865 | ┌─ ┌──────────────────────────────────┐ 866 | │ │ Compiler, debugger, etc. │ 867 | │ └──────────────────────────────────┘ 868 | JDK ┌─ ┌──────────────────────────────────┐ 869 | │ │ │ │ 870 | │ JRE │ JVM + Runtime Library │ 871 | │ │ │ │ 872 | └─ └─ └──────────────────────────────────┘ 873 | ┌───────┐┌───────┐┌───────┐┌───────┐ 874 | │Windows││ Linux ││ macOS ││others │ 875 | └───────┘└───────┘└───────┘└───────┘ 876 | 877 | 图源自:https://www.liaoxuefeng.com/wiki/1252599548343744/1255876875896416 878 | ``` 879 | 880 | ##### OracleJDK 881 | > 仅 JDK 17 及以上版本才支持 Apple Silicon。 882 | > 883 | > JDK 8 需登录 Oracle 账户才能下载,且没有 ARM 版本。(虽然 x64 版本也可以安装使用,但不清楚是否存在问题) 884 | > 885 | > 不是很推荐使用 OracleJDK,因为其协议已改为 [OTN](https://www.oracle.com/java/technologies/javase/jdk-faqs.html) 886 | 887 | 下载地址: https://www.oracle.com/java/technologies/downloads 888 | 889 | 根据 CPU 选择包: 890 | - **Intel**: `x64 DMG Installer` 891 | - **Apple Silicon**: `Arm 64 DMG Installer` 892 | 893 | 下载安装,然后验证: 894 | ```shell 895 | ➜ ~ java -version 896 | java version "1.8.0_311" 897 | Java(TM) SE Runtime Environment (build 1.8.0_311-b11) 898 | Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode) 899 | ``` 900 | 901 | 配置 `JAVA_HOME` 环境变量: 902 | ```shell 903 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home 904 | ``` 905 | 906 | ##### OpenJDK 907 | OpenJDK 是 Sun 在 2006 年开源的 Java SE 免费开源版本,采用 `GPLv2+CE` 许可协议。该项目由 Oracle 主导,IBM、红帽、微软等均有参与。 908 | 909 | 官网: https://openjdk.org 910 | 911 | - Homebrew 安装 912 | ```shell 913 | // 搜索 914 | brew search openjdk 915 | 916 | // 安装 917 | // 苹果芯片不一定支持老版本,失败则可考虑安装 Zulu 版本 918 | brew install openjdk@8 919 | 920 | // 配置 921 | sudo ln -sfn /opt/homebrew/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk 922 | ``` 923 | 924 | - Zulu 安装 925 | 926 | 下载对应版本: https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk 927 | 928 | 对应的安装教程: https://docs.azul.com/core/zulu-openjdk/install/macos 929 | 930 | ```shell 931 | ➜ java -version 932 | openjdk version "1.8.0_342" 933 | OpenJDK Runtime Environment (Zulu 8.64.0.15-CA-macos-aarch64) (build 1.8.0_342-b07) 934 | OpenJDK 64-Bit Server VM (Zulu 8.64.0.15-CA-macos-aarch64) (build 25.342-b07, mixed mode) 935 | ``` 936 | 937 | 对应的 `JAVA_HOME` 在 `/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home` 938 | 939 | 940 | ##### SDKMAN 941 | 一个专门安装、管理 SKD 的跨平台 Shell 脚本软件,支持几乎所有厂商的 JDK 及常用 SDK。 942 | 943 | 官网及教程: https://sdkman.io 944 | 945 | 以 JDK 为例,其他 SDK 类似。 946 | 947 | - 安装 SDKMAN 948 | 949 | ```shell 950 | curl -s "https://get.sdkman.io" | bash 951 | source "$HOME/.sdkman/bin/sdkman-init.sh" 952 | ``` 953 | 954 | 安装目录 `$HOME/.sdkman` 955 | 956 | - 查看支持的 JDK 版本列表 957 | 958 | ```shell 959 | 960 | ================================================================================ 961 | Available Java Versions for macOS ARM 64bit 962 | ================================================================================ 963 | Vendor | Use | Version | Dist | Status | Identifier 964 | -------------------------------------------------------------------------------- 965 | Java.net | | 20.ea.9 | open | | 20.ea.9-open 966 | | | 20.ea.8 | open | | 20.ea.8-open 967 | | | 19.ea.34 | open | | 19.ea.34-open 968 | | | 19.ea.33 | open | | 19.ea.33-open 969 | | | 18.0.2 | open | | 18.0.2-open 970 | | | 18.0.1.1 | open | | 18.0.1.1-open 971 | Microsoft | | 17.0.4 | ms | | 17.0.4-ms 972 | | | 17.0.3 | ms | | 17.0.3-ms 973 | | | 11.0.16 | ms | | 11.0.16-ms 974 | | | 11.0.15 | ms | | 11.0.15-ms 975 | Oracle | | 18.0.2 | oracle | | 18.0.2-oracle 976 | | | 18.0.1 | oracle | | 18.0.1-oracle 977 | | | 17.0.4 | oracle | | 17.0.4-oracle 978 | | | 17.0.3 | oracle | | 17.0.3-oracle 979 | ``` 980 | 981 | 982 | - 安装 JDK 983 | 984 | ```shell 985 | // OracleJDK 986 | sdk install java x.y.z-oracle 987 | 988 | // OpenJDK 989 | sdk install java x.y.z-open 990 | ``` 991 | 992 | - 查看切换默认 JDK 版本 993 | 994 | ```shell 995 | // 查看当前版本 996 | sdk current java 997 | 998 | // 切换默认版本 999 | sdk default java x.y.z-open 1000 | ``` 1001 | 1002 | ##### IDEA 1003 | `IntelliJ IDEA` 提供了 JDK 管理功能,可添加已存在的 JDK,也可代为下载安装所需 JDK。 1004 | 1005 | 操作步骤:`MenuBar` → `File` → `Project Structure...`(`⌘ + ;`) → `SDKs` → `+` → `Download JDK` 1006 | 1007 | ![idea-jdk-download](assets/idea-jdk-download.jpg) 1008 | 1009 | 1010 | 1011 | ##### JAVA_HOME 1012 | 查看已安装版本的 `JAVA_HOME`: 1013 | ```shell 1014 | /usr/libexec/java_home 1015 | 1016 | /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home 1017 | /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home 1018 | ``` 1019 | 1020 | 查看指定版本的 `JAVA_HOME`: 1021 | ```shell 1022 | /usr/libexec/java_home -v8 1023 | 1024 | /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home 1025 | ``` 1026 | 1027 | 单个版本配置(`~/.zshrc`): 1028 | ```shell 1029 | export JAVA_HOME=$(/usr/libexec/java_home -v8) 1030 | ``` 1031 | 1032 | 多版本配置: 1033 | ```shell 1034 | # Java Home 1035 | export JAVA_HOME=$(/usr/libexec/java_home -v11) 1036 | export JAVA_8_HOME=$(/usr/libexec/java_home -v8) 1037 | export JAVA_11_HOME=$(/usr/libexec/java_home -v11) 1038 | 1039 | alias java8='export JAVA_HOME=$JAVA_8_HOME' 1040 | alias java11='export JAVA_HOME=$JAVA_11_HOME' 1041 | 1042 | # 默认为 Java 8 1043 | java8 1044 | ``` 1045 | 1046 | 1047 | #### Maven 1048 | - 安装 1049 | 1050 | ```shell 1051 | brew install maven 1052 | ``` 1053 | 1054 | > 如果只使用 `IDEA`,可无需安装,直接使用 IDE 内置的 Maven 即可。 1055 | 1056 | - 国内镜像配置 1057 | 1058 | 以 [阿里云 Maven](https://developer.aliyun.com/mvn/guide) 为例。打开或创建配置文件:`$HOME/.m2/settings.xml`,并修改: 1059 | 1060 | ```xml 1061 | 1062 | 1065 | 1066 | 1067 | 1068 | aliyunmaven 1069 | * 1070 | 阿里云公共仓库 1071 | https://maven.aliyun.com/repository/public 1072 | 1073 | 1074 | 1075 | ``` 1076 | 1077 | 1078 | ### PHP 1079 | #### 安装 1080 | 1081 | - 第三方源 1082 | > 由于官方维护的 PHP 版本都是最新的几个,对于比较老的版本,无法直接安装,如果需要可 Tap 第三方源 1083 | 1084 | 强烈推荐: [shivammathur/php](https://github.com/shivammathur/homebrew-php) 1085 | 1086 | > 添加 Tap 1087 | ```shell 1088 | brew tap shivammathur/php 1089 | ``` 1090 | 1091 | - 安装 PHP 1092 | 1093 | > 此处示例安装 `PHP 7.4` 1094 | ```shell 1095 | brew install php@7.4 1096 | ``` 1097 | 1098 | > 将此版本替换为命令行默认版本 1099 | ```shell 1100 | brew link --overwrite --force php@7.4 1101 | ``` 1102 | 1103 | > 添加到 PATH 1104 | ```shell 1105 | echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc 1106 | echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc 1107 | ``` 1108 | 1109 | - 配置 1110 | 1111 | > 打开配置文件修改默认时区 1112 | ```ini 1113 | date.timezone = PRC 1114 | ``` 1115 | 1116 | 1117 | #### Composer 1118 | - 安装 1119 | 1120 | 通过 brew 安装: 1121 | ```shell 1122 | brew install composer 1123 | ``` 1124 | 1125 | 或者手动安装: 1126 | ```shell 1127 | curl -o composer https://getcomposer.org/download/latest-stable/composer.phar 1128 | chmod +x composer 1129 | [ ! -d "/usr/local/bin" ] && sudo mkdir /usr/local/bin 1130 | sudo mv composer /usr/local/bin 1131 | ``` 1132 | 1133 | - 降级 1134 | 1135 | 如果一些老项目不支持 Composer V2,那么需要回退到 V1 版本 1136 | ```shell 1137 | composer self-update --1 1138 | ``` 1139 | 1140 | - 镜像 1141 | ```shell 1142 | // 设置镜像 1143 | composer config -g repo.packagist composer [mirrors-url] 1144 | 1145 | // 取消镜像 1146 | composer config -g --unset repos.packagist 1147 | ``` 1148 | 1149 | ``` 1150 | // 阿里云 1151 | 官网: https://developer.aliyun.com/composer 1152 | 镜像: https://mirrors.aliyun.com/composer/ 1153 | 1154 | // 腾讯云 1155 | // 出现过composer.lock文件中dist.reference与dist.url下载不一致的情况 1156 | // 即reference是最新commit,但镜像url下载的包却不非最新 1157 | 官网: https://mirrors.cloud.tencent.com/help/composer.html 1158 | 镜像: https://mirrors.cloud.tencent.com/composer/ 1159 | ``` 1160 | 1161 | 其他镜像不是很稳定、或不是很全(一些下载量小的会 `404`),如有问题,轮换着试试。 1162 | 1163 | 1164 | ### Go 1165 | #### 安装 1166 | 安装最新版本 1167 | ```shell 1168 | brew install go 1169 | ``` 1170 | 1171 | 或者指定版本 1172 | ```shell 1173 | brew install go@1.13 1174 | ``` 1175 | 1176 | 非最新版本,需要建立个链接,这样才能用到 Go 命令 1177 | ```shell 1178 | brew link --overwrite --force go@1.13 1179 | ``` 1180 | 1181 | 1182 | #### 配置 1183 | - 环境变量 1184 | 1185 | ```shell 1186 | export GO111MODULE=on 1187 | export GOPATH=/Users/jioby/gowork 1188 | export PATH="$GOPATH/bin:$PATH" 1189 | export GOPROXY=https://goproxy.cn,https://goproxy.io,direct 1190 | export GOPRIVATE=*.your-private-git.com 1191 | ``` 1192 | 1193 | - 私有仓库 1194 | 1195 | 终端运行命令 `git config --global -e`,添加如下类似配置并保持: 1196 | ```shell 1197 | [url "ssh://git@git.example.com:8182/"] 1198 | insteadOf = https://git.example.com/ 1199 | ``` 1200 | 1201 | 1202 | --------------------------------------------------------------------------------