Tepmnthar
Tepmnthar

Reputation: 557

How to use Swift Package Manager(SPM) in cli?

I'm a newbie to swift. I don't know and I can't find out how to use Swift Package Manager in command line.

Is there any equivalent stuff to Podfile pod install and pod update? How to add a local package dependency to the project?

Xcode SPM GUI is totally unusable because of some proxy problems.

Upvotes: 3

Views: 3996

Answers (1)

Tepmnthar
Tepmnthar

Reputation: 557

I have followed those steps to solve the problem.

  1. set git HTTP proxy
git config --global http.proxy http://0.0.0.0:1087
git config --global http.proxy socks5://0.0.0.0:1080
  1. set ssh proxy for host

Append those lines at the end of ~/.ssh/config to add a socks5 proxy

Host github.com
ProxyCommand nc -X 5 -x 0.0.0.0:1080 %h %p
  1. use xcodebuild command to resolve package dependencies

Remember you must add the -scmProvider system option to force xcodebuild to use system git and git configurations, or it will use the xcode built-in git which will never go through the proxy.

xcodebuild -resolvePackageDependencies -scmProvider system

Some references here:

Upvotes: 3

Related Questions