【Homebrew】之相关命令问题合集及iOS真机调试包
一、Homebrew更换国内镜像源(中科大、阿里、清华)
Homebrew主要有四个部分组成: brew、homebrew-core 、homebrew-bottles、homebrew-cask。
名称 | 说明 |
---|---|
brew | Homebrew 源代码仓库 |
homebrew-core | Homebrew 核心软件仓库 |
homebrew-bottles | Homebrew 预编译二进制软件包 |
homebrew-cask | MacOS 客户端应用 |
查看 brew.git 当前源
cd "$(brew --repo)" && git remote -v
查看 homebrew-core.git 当前源
cd "$(brew --repo homebrew/core)" && git remote -v
如果输出是下面这些,就代表不是本地镜像源,可以换成本地镜像源,这样下载会更快点。
查看 brew.git 当前源输出
origin https://github.com/Homebrew/brew.git (fetch)
origin https://github.com/Homebrew/brew.git (push)
查看 homebrew-core.git 当前源输出
origin https://github.com/Homebrew/homebrew-core.git (fetch)
origin https://github.com/Homebrew/homebrew-core.git (push)
替换中科大镜像源:
# 替换homebrew默认源 cd /usr/local git remote set-url origin git://mirrors.ustc.edu.cn/brew.git # 替换homebrew-core默认源 cd /usr/local/Library/Taps/homebrew/homebrew-core git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git # 替换homebrew-cask默认源 cd /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-cask.git # 替换homebrew bottles默认源 echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bashrc sourch ~/.bashrc
其他源参考文章:
①weixin_33743661《更换 homebrew 国内镜像源》
②TyrantBoy《Homebrew更换国内镜像源(中科大、阿里、清华)》
③刘悦的技术博客《Mac os:将Homebrew的下载源换成国内镜像增加下载速度(阿里云镜像)》
二、homebrew-core、homebrew-cask报错
homebrew-core is a shallow clone.
homebrew-cask is a shallow clone.
1、解决办法:(推荐)
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
2、或者解决homebrew-core报错,homebrew-cask同上:(次推荐)
cd /usr/local/Homebrew/Library/Taps/homebrew rm -rf homebrew-core brew upgrade
参考文章:
①水麒麟灬《Mac homebrew报错Error: homebrew-core is a shallow clone.》
②那钱有着落吗《mac homebrew-cask is a shallow clone》
③图文教程《homebrew-core is a shallow clone》
三、Error: Cannot tap homebrew/core: invalid syntax in tap!报错
但是删除homebrew-core之后会一直更新失败,原因是之前homebrew-core没有更换国内源,只能手动下载
git clone https://mirrors.ustc.edu.cn/homebrew-core.git
参考文章:《brew安装失败Error: Invalid formula:》
解决办法:
# 进入homebrew cd /usr/local/Homebrew/Library/Taps/homebrew # git下载 git clone https://mirrors.ustc.edu.cn/homebrew-core.git # 更新 brew update
四、安装ideviceinstaller报错
brew install ideviceinstaller
报错:fatal: Unable to create '/usr/local/Homebrew/.git/index.lock': File exists.
参考文章:ZeroFlutter《git 提交出现这个错误fatal: Unable to create ‘project_path/.git/index.lock’: File exists. exists》
# 进入Homebrew cd /usr/local/Homebrew/ # 删除index.lock rm -f ./.git/index.lock
但是更新时候还是报错:
Error: ideviceinstaller: Failed to download resource "libtasn1"
Download failed: https://ftpmirror.gnu.org/libtasn1/libtasn1-4.18.0.tar.gz
查看下载得知,应该是下载源的问题,因为我之前没有更新国内源,更新操作看【一】:
更新中科大镜像源:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
再安装ideviceinstaller,成功!
brew install ideviceinstaller
参考文章:
①金牛肖马《Mac如何安装使用libimobiledevice,ideviceinstaller(类似adb )》
②chen_2987《mac真机命令及ideviceinstaller安装》
③chaner女侠《在Mac机上用命令idevice_id -l来查udid和ideviceinstaller -l来查看bundleId出现错误》
五、IOS命令截图(未解决)
idevicescreenshot test.png
截图报错:Could not start screenshotr service! Remember that you have to mount the Developer disk image on your device if you want to use the screenshotr service.
需要下载对应的真机调试包到xcode中
# 查看手机版本 ideviceinfo -k ProductVersion # 进入支持版本 cd /Applications/Xcode/Xcode10.0.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport # 安装 ideviceimagemounter DeveloperDiskImage.dmg
参考文章:
①BYINCD《openstf支持ios设备和问题解决》*****大佬的文章
②编码美丽《iOS安全逆向之旅--安全逆向环境搭建和工具使用介绍》
③llIIIllIllII《iOS15真机调试包(14 - 15.4)》*****下载包
但是发现还是报错:Could not connect to screenshotr!
尝试其他办法,待解决
六、安装ifuse
brew install ifuse
报错:Error: ifuse has been disabled because it requires closed-source macFUSE!
参考文章:黄美腻《【解决】brew无法安装三方库的问题:ifuse has been disabled because it requires closed-source macFUSE》
原因:
ifuse等三方库不再开源,FUSE底层基础软件闭源,依赖FUSE的三方库都受到影响,导致Homebrew不支持直接安装这些库了~~
解决方法:
brew install macfuse ##确保已经安装macFUSE brew formula ifuse ##获取ifuse的路径 $location_ifuse vim $location_ifuse ##编辑ifuse的文件 注释以下段落后保存(:wq) # on_macos do # disable! date: "2021-04-08", because: "requires closed-source macFUSE" # end brew install ifuse ##安装ifuse
七、安装gnutls
brew install gnutls
安装报错:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
参考文章:Sirius_96《curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused的几种解决方式》
原因是:ping这个raw.githubusercontent.com地址,ping不上
ping raw.githubusercontent.com
解决方案:
(1)打开网站
https://www.ipaddress.com/
查询一下 raw.githubusercontent.com
对应的IP 地址
修改hostst文件
vim /etc/hosts
加上ip地址
再ping成功了
但是再次安装又报错了:curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443
参考文章:HZ_Fang《curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.gith》
直接在hosts最后添加即可
#github 192.30.253.xxx github.com 151.101.113.xxx github.global.ssl.fastly.net 以上两个地址,还是参考之前的网站获取
附录:
①悄然林静《Mac下用终端工具libimobiledevice管理iPhone》