Install CocoaPods Without Sudo on macOS
Content edited . An isolated CocoaPods installation and macOS fixture build were verified. See the test scope and limitations below.
On this page
To install CocoaPods without administrator privileges, use a compatible Ruby, a user-owned gem directory, and a PATH that selects their executables. Changing GEM_HOME does not install or switch Ruby. Check all three before adding sudo to an error message.

Choose an installation route
| Starting point | Recommended next step |
|---|---|
| A compatible Ruby is already configured outside system Ruby | Keep that interpreter and install gems into a writable directory. |
| Only macOS system Ruby is available | Prepare a separate compatible Ruby first; a writable GEM_HOME cannot fix an unsupported interpreter. |
| The project already has Gemfile and Gemfile.lock | Follow that project’s tool versions and use bundle exec. Do not replace its Gemfile with this example. |
| A working Homebrew-managed pod is already installed | Check its wrapper and Ruby ownership before mixing it with a separate gem/Bundler environment. |
CocoaPods recommends a Ruby separate from macOS’s system Ruby. Homebrew or a Ruby version manager can supply it, but each has its own installation requirements. This walkthrough starts with an existing compatible Ruby; it does not claim that preparing Homebrew or Ruby always requires no administrator access.
Check and select the interpreter
command -v ruby
ruby --version
gem --version
gem env home
command -v pod
Select your independently installed Ruby with its version manager’s initialization, or prepend its actual bin directory to PATH. For a direct installation, replace the example directory before using it:
audit_ruby_bin='/path/to/your/compatible/ruby/bin'
export PATH="$audit_ruby_bin:$PATH"
command -v ruby
ruby --version
Do not infer the interpreter from pod --version alone. A Homebrew pod launcher can select a different Ruby or GEM_HOME from the Ruby shown in your shell.
Install into a user-owned gem directory
The following directory is an example for the Ruby you just selected. Keep incompatible Ruby installations in separate gem directories, especially when gems contain native extensions.
mkdir -p "$HOME/Vendor/ruby"
export GEM_HOME="$HOME/Vendor/ruby"
export GEM_PATH="$GEM_HOME"
export PATH="$GEM_HOME/bin:$PATH"
gem install cocoapods
pod --version
This deliberately isolated GEM_PATH excludes other installed gem directories; Ruby’s default gems remain available. If an existing project requires another environment, follow that project’s setup rather than silently replacing it.
For a pinned project, install the required version instead of the unversioned command:
gem install cocoapods -v 1.15.2 --no-document
1.15.2 is the version used for the verification below, not a recommendation to downgrade or a claim that it is the newest release. Select a compatible version for your actual project. Do not run both installation commands merely to follow every code block.
Persist the selected environment and verify a new shell
For an interactive zsh session, add the selected Ruby initialization or bin PATH and the gem exports to ~/.zshrc. Preserve existing settings; use the appropriate startup file for a different shell. Do not leave the placeholder Ruby path in your profile.
Open a new Terminal window and inspect:
command -v ruby
ruby --version
gem env home
command -v pod
pod --version
gem which cocoapods
The gem directory and pod executable should belong to the environment you intended. source ~/.zshrc reloads settings already written; it does not save them. Review path output for personal or private configuration before sharing it.
Pin the shared project’s tooling
Use the project’s existing Gemfile when available. This minimal example uses the same historical version as the test:
source "https://rubygems.org"
gem "cocoapods", "1.15.2"
Check bundle --version with the selected Ruby. If Bundler is missing, install a Bundler version compatible with that interpreter into the chosen user directory. A wrapper named bundle is not proof that its interpreter can load Bundler.
From the directory containing the Gemfile and your project’s Podfile:
bundle install
bundle exec pod --version
bundle exec pod install
Keep Gemfile.lock for Ruby tooling and Podfile.lock for resolved pods. Review their diffs, use the generated .xcworkspace, and build the intended scheme. Do not run pod update as a substitute for verifying a locked install. The CocoaPods Gemfile guide explains why running pod without bundle exec can select another installed version.
For an existing application, confirm the workspace builds with its own deployment target, dependency sources and signing setup. Successful tool installation does not prove that every pod is compatible with a new Xcode release.
Diagnose the correct layer
| Failure | Inspect | Next step |
|---|---|---|
| Permission denied writing gems | gem env home and directory ownership | Correct the installation directory; do not add sudo before checking Ruby compatibility. |
| A gem requires another Ruby version | ruby –version and the reported requirement | Select a compatible interpreter; GEM_HOME cannot change it. |
| pod is not found | Installation result and PATH | Put the completed installation’s bin directory on PATH. |
| Wrong pod version | command -v pod and bundle exec pod –version | Resolve wrapper/PATH conflicts and the project pin. |
| Bundler cannot find its gem | command -v bundle, Ruby and gem environment | Make Bundler available to the selected interpreter. |
| Specs/CDN download fails | Failing URL, network/proxy and Podfile sources | Diagnose source access; reinstalling into another GEM_HOME does not repair the network. |
| Installation succeeds but the project fails to build | Workspace, scheme, deployment target and build log | Treat this as project integration, not automatically as gem installation failure. |
A relevant legacy source case is CocoaPods 1.8.5 CDN Response 400. An SSH identity warning is a separate GitHub host-key verification task.
Actual verification on October 14, 2026
The test used an arm64 Mac with macOS 27.0 (26A428), an already installed Ruby 3.3.1, RubyGems 3.5.9, Bundler 2.5.9, CocoaPods 1.15.2 and Xcode 27.0 (27A266a). Gems, CocoaPods home/cache, the fixture project and derived data were isolated in temporary directories. No sudo was used for gem installation; system Ruby, existing project dependencies and shell profiles were not changed.
Observed results:
gem install cocoapods -v 1.15.2 --no-documentagainst the official RubyGems source installed 36 gems successfully.- A new clean zsh process with the test PATH selected Ruby 3.3.1 and the isolated pod executable;
pod --versionreturned 1.15.2. This tests executable selection, not persistence in a modified user profile. bundle install --localresolved the fixture Gemfile using the available gem installation and created Gemfile.lock. This was a local-resolution test, not a second fresh network install.bundle exec pod installresolved one local Swift development pod, generated the workspace and wrote Podfile.lock. CocoaPods also initialized its CDN source, so this was not an entirely offline install.- The generated workspace built successfully with
xcodebuild, the Fixture scheme and a generic macOS destination, with code signing disabled. CocoaPods warned that this framework fixture had no embedding host target, and Xcode emitted a script-sandboxing warning; these results do not establish an iOS application build or runtime behavior.
The fixture was a macOS framework using a local Swift pod, not an iOS app or a representative production dependency graph.
The system-default shell still reported Ruby 2.6.10 and its default Bundler launcher could not find a usable Bundler gem. That earlier mixed-tooling observation explains why selecting the interpreter matters; it is not the environment recommended above.