Using CocoaPods on Windows

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. With over 60 thousand libraries, it is the most popular repository of its kind, impacting over 3 million apps (quoting the official site).

Traditionally, the CocoaPods only targeted macOS, which made sense as it was meant to work with Xcode and the related toolchain. However, the success of cross-platform development frameworks such as Flutter or React Native gave rise to demand for CocoaPods to work on non-macOS platforms such as Windows (for example, some folks have reported issues #8055 and #8077).

Starting with CocoaPods 1.7 (in Beta as of time of writing), it is now possible to get some basic operations, such as pod install and pod update to run on Windows. This guide walks through the necessary steps to get this to work.

Step one — install Ruby

When installing Ruby, accept the defaults but make sure “Use UTF-8 as default external encoding” is selected. Ruby will prompt to install MSYS — pick the first option (MSYS2 base installation).

To confirm that Ruby has been properly installed, open a command prompt and type “gem list”. If a list of gems is displayed, you’re all set.

Step two — install curl

For example, if you’ve extracted curl as C:\curl-7.64.1_1-win64-mingw, add the following to your path: C:\curl-7.64.1_1-win64-mingw\bin (see “Environment Variables” in Advanced System Settings).

To confirm that curl has been installed, open a command prompt and type “curl — help” — this should display the curl help pages.

Step three — install git

To confirm that git and Unix tools have been installed, open a command prompt and type the “git” and “tar” commands.

Step four — install CocoaPods

Run “gem install cocoapods” to install the latest released version of CocoaPods. At the time of the writing, Windows support is only available in the Beta of CocoaPods 1.7.0, meaning you will need to run “gem install cocoapods — pre” instead.

To confirm, open a command prompt and run the following command: “pod — version”. You should see version 1.7.0 or higher.

Step five — running pod commands (optional)

  • Transfer the Xcode project to the Windows machine
  • Navigate to the project folder using the command line
  • Run “pod init” to create the Podfile
  • Edit the Podfile and add some pods (for example, you can add “Firebase/Analytics”)
  • Run “pod install” to install the pods

Write code for fun and living

Write code for fun and living