肇鑫的技术博客

业精于勤,荒于嬉

Fix of Xcode SPM Downloading Speed Issue

This command will fixed the issue that Xcode downloading too slow with SPM. Say you have a project name "hello", there is a Package.swift in it.

$ cd hello
$ xcodebuild -resolvePackageDependencies -scmProvider system
$ open Package.swift

hello

This issue was because when using git, Xcode ignore the proxy setting by default.

Pre-request

You should have your proxy set, for me, I have

$ cat .bashrc 
# proxy list
alias proxy='export all_proxy=socks5://127.0.0.1:7890'
alias unproxy='unset all_proxy'

# run
proxy

Xcode not follows system proxy settings to resolve SwiftPM dependencies

Xcode 13 ignores GIT proxy settings when resolving SwiftPM packages (and probably for other SCM operations as well).