What this guide covers
When you finish, pod install runs to completion in your project directory and generates the workspace. You need: Xcode or the Command Line Tools installed, Homebrew (recommended), and network access to the dependency sources.
Steps
Pick an install method that does not need system-level privileges
The default command on the official CocoaPods getting started page installs with RubyGems. The page notes that with the Ruby that ships with macOS, this command has to run as the superuser. On a rented machine we suggest avoiding that form and using one of the three below.
Homebrew has a package of the same name, which is the least effort:
brew install cocoapodsAlternative: install into your own user directory
The section of the official page on installing without elevated privileges gives two approaches. One is to add
--user-install:gem install cocoapods --user-installAfterwards
podis not necessarily on your PATH; the official example usesgem which cocoapodsto find where it went. The other is to setGEM_HOMEto a user directory in your shell configuration and add it to PATH. This is the one the official page recommends more; see that page for the exact two lines.Team projects: lock the version with Bundler
If the repository has a
Gemfile, the project pins the CocoaPods version with Bundler. In that case install withbundle installand run withbundle exec pod install, rather than installing whatever version globally. Mismatched versions produce meaningless changes inPodfile.lock.The first pod install
Run this in the directory that contains the
Podfile:pod installWhen it finishes, open the generated
.xcworkspace, not the original.xcodeproj. If it says a version of a dependency cannot be found, add--repo-updateso it updates the dependency index before installing. CommitPodfile.lockto the repository.The first run downloads every dependency, and speed depends on the line. You can run it inside a tmux session so it keeps going if the remote session disconnects.
Credentials for private dependencies
When the Podfile references private Git repositories, this machine needs permission to fetch them. We suggest generating a read-only deploy key or access token just for this machine instead of copying your personal full-permission key onto it. That way, before the rental ends you only revoke this one credential on your code hosting platform, and your other devices are unaffected.
Cache and cleanup
CocoaPods caches the dependencies it has downloaded, and after enough branch and project switches that takes a fair amount of disk:
pod cache list pod cache clean --allThe
Podsdirectory in the project can be deleted at any time and rebuilt withpod install.pod deintegrateremoves CocoaPods from the project altogether; it is not for clearing the cache, so do not use it by mistake.Keep an eye on the official read-only plan
The CocoaPods team announced on its official blog that the main repository (trunk) will become read-only, after which it accepts no new pods and no new versions. Existing builds keep working and private sources are unaffected. Go by the announcement for the exact dates.
This means dependencies will no longer receive updates through trunk. For new projects, consider Swift Package Manager first. Older projects still install as usual, but it is worth starting to take stock of which dependencies have a SwiftPM version.
FAQ
Running pod says "command not found". What now?
If you installed with --user-install, the executable is under the user gem directory and that directory needs to be added to PATH. Installing with Homebrew does not have this problem.
The install fails with no write permission. How do I fix it?
That comes from installing into the system Ruby directory. Do not change permissions on system directories for it; switch to Homebrew or a user-directory install.
pod install is very slow or fails partway. What should I check?
Add --verbose first to see which dependency it is stuck on. Download speed depends on the line and the load. Do not install a proxy or change this machine's network configuration to speed it up; that is outside what is permitted.
What CocoaPods-related cleanup is needed before the rental ends?
The Pods directory and the cache can both be rebuilt, so no backup is needed. What you should do is confirm Podfile and Podfile.lock are committed and pushed, and revoke the private repository credentials you issued for this machine.
Related
- How do I build an iOS ipa for a Flutter app developed on Windows?
- Can I install Node, Homebrew and Docker on a rented Mac mini myself?
- Where does Xcode cache Swift packages, and how do I pin and clear the cache?
- Xcode filled up my disk: how to clear DerivedData and what else is safe to delete
- Text too small or blurry on a remote Mac mini: adjust resolution and scaling
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support