Mac 开发遇到的问题

234 阅读1分钟

一、brew 安装mkcert 报错处理

问题描述

前提:brew 已安装;

操作:

brew install mkcert

报错:

==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 717436, done.
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.

解决方案:

// 执行下面这句命令,更换为中科院的镜像:
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

// 把homebrew-core的镜像地址也设为中科院的国内镜像

cd "$(brew --repo)" 

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" 

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

// 更新
brew update

二、解决git的Enter passphrase for key '/c/Users/Administrator/.ssh/id_rsa'问题

在 MacOS 上你可以用下面的命令将你的私钥加入到 Keychains:

ssh-add -K /path/to/private_key
如果你的私钥 private key 存储在 ~/.ssh 目录下且名为 id_rsa的话:

ssh-add -K ~/.ssh/id_rsa

解决 Mac 下 localhost 无法访问

直接打开etc目录,使用命令行,复制如下命令

open /etc

找到hosts文件,复制一份到桌面上,用编辑器打开,找到最上面的配置

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

添加一行

fe80::1%lo0 localhost