【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

其他源參考文章:

更換 homebrew 國內鏡像源

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.

參考文章: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_2987mac真機命令及ideviceinstaller安裝

在Mac機上用命令idevice_id -l來查udid和ideviceinstaller -l來查看bundleId出現錯誤

使用命令行對ios設備截屏

五、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

 參考文章:

BYINCDopenstf支持ios設備和問題解決*****大佬的文章

iOS安全逆向之旅--安全逆向環境搭建和工具使用介紹

llIIIllIllIIiOS15真機調試包(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

參考文章: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 

參考文章: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

ios小袁君iOS自動化【一點經驗】

③《libimobiledevice 一些常用指指令

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM