前提
拿到公司新电脑,配置一波
踩坑
- 准备安装 Iterm 听说厉害的开发用这个。没办法,技术不行,装逼来凑。
- 听说 Iterm 和 Oh My Zsh 更配哦。行吧,那就下一个 Oh My Zsh。
Book-Pro ~ % sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Cloning Oh My Zsh...
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Error: git clone of oh-my-zsh repo failed
复制代码
- 报错了,失败了,行吧,换一种方法:
Book-Pro ~ % git clone https://github.com/ohmyzsh/ohmyzsh.git
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
复制代码
- 因为电脑上并没有自带 git,提示如下图:
5. 没啥软用,安装进度条等的我花都谢了也不带动的。永远停留在三分之一。好吧,然后去搜 git 安装:git-scm.com/download/ma…
6. 发现要安装 brew , 听说也是个好东西,厉害的开发都在用。行吧,那就它了。(因为没翻墙,只能用这个了。直接用官网的会需要用 Xcode,但太大了,pass!)
Book-Pro ~ % /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
开始执行Brew自动安装程序
[cunkai.wang@foxmail.com]
['2021-04-20 17:05:17']['10.15']
https://zhuanlan.zhihu.com/p/111014448
请选择一个下载镜像,例如中科大,输入1回车。
源有时候不稳定,如果git克隆报错重新运行脚本选择源。cask非必须,有部分人需要。
1、中科大下载源 2、清华大学下载源 3、北京外国语大学下载源 4、腾讯下载源(不推荐) 5、阿里巴巴下载源(不推荐 缺少cask源)
请输入序号: 1
你选择了中国科学技术大学下载源
!!!此脚本将要删除之前的brew(包括它下载的软件),请自行备份。
->是否现在开始执行脚本(N/Y) y
--> 脚本开始执行
Mac os设置开机密码方法:
(设置开机密码:在左上角苹果图标->系统偏好设置->用户与群组->更改密码)
(如果提示This incident will be reported. 在用户与群组中查看是否管理员)
==> 通过命令删除之前的brew、创建一个新的Homebrew文件夹
请输入开机密码,输入过程不显示,输入完后回车
Password:
开始执行
---备份要删除的/usr/local/Homebrew到系统桌面....
---/usr/local/Homebrew 备份完成
-> 创建文件夹 /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
此步骤成功
运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown kye /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
安装Git后再运行此脚本,在系统弹窗中点击“安装”按钮
如果没有弹窗的老系统,需要自己下载安装:https://sourceforge.net/projects/git-osx-installer/
xcode-select: note: install requested for command line developer tools
复制代码
- 垃圾!又要我安装 git !但我是不会屈服的!找找找,发现还可以用 Xcode Command Line Tools 这个安装 git,来试一波:
我们选择手动安装(你也可以尝试使用:xcode-select –install 命令安装该工具): developer.apple.com/download/mo…
- 安装:
测试一下安装是否成功:
Book-Pro ~ % gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Book-Pro ~ % git version
git version 2.24.3 (Apple Git-128)
复制代码
成功!
- 重复第六步骤,成功运行:
- 安装 yarn
安装 node: nodejs.org/zh-cn/downl…
然后用 npm 安装 yarn,报错:
npm install -g yarn
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kye/.npm/_logs/2021-04-21T11_56_31_343Z-debug.log
复制代码
是因为没有权限写入
解决: sudo npm i -g yarn
➜ ~ sudo npm i -g yarn
> yarn@1.22.10 preinstall /usr/local/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)
/usr/local/bin/yarnpkg -> /usr/local/lib/node_modules/yarn/bin/yarn.js
/usr/local/bin/yarn -> /usr/local/lib/node_modules/yarn/bin/yarn.js
+ yarn@1.22.10
added 1 package in 1.462s
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END