Search code examples
ioscocoapodsdiskspace

`pod setup` consuming a significant amount of disk space


I just discovered today that the master Specs repo for Cocoapods was taking up 27GB of disk space in my ~/.cocoapods directory. After doing some research it appears this happened as part of the upgrade to v1 and is likely the cause for the long-running commands referenced here:

https://github.com/CocoaPods/CocoaPods/issues/4989

And then the rationale for switching from a shallow to a full copy is outlined by the team here:

http://blog.cocoapods.org/Master-Spec-Repo-Rate-Limiting-Post-Mortem/

Understandable reasoning, especially in terms of the CPU utilization problem.

The disk space required, though, is just too much (10% of my 256GB drive) - especially when considering that some of that precious space on my laptop is being used for xuchenOnlyTestDemo, xuchenOnlyTestDemoTwo, xuchenOnlyTestDemoThree, and xuchenOnlyTestDemoFive. Not terrible offenders specifically, but more an indication of the problem that there are a ton of Specs being pulled that I don't anticipate using.

I'm re-running pod setup after having removed the master repo locally to see if I had something wacky in my local setup, but it appears not:

pod setup --verbose

Setting up CocoaPods master repo

Cloning spec repo `master` from `<CocoaPods Specs repo>` (branch `master`)
  $ /usr/bin/git clone <CocoaPods Specs repo> master
  Cloning into 'master'...
  Checking out files:  22% (22726/100426) 

(I had to substitute <CocoaPods Specs repo> in the output above because SO wouldn't let me include more than 2 urls.)

Setup is back to 5GB used and climbing. I am presently using an SD card as an extended storage option and have my ~/.cocoapods symlinked over to a directory on that mounted drive (OSX El Capitan). So that helps, but isn't ideal.

Are others experiencing the same issue? Anyone have a workaround to having the full master repo cloned locally?


Solution

  • I recently had to run pod repo update and the job again ran for 8+ hours and now consumed 38GB of disk space on the linked SD card.

    I managed to free up enough space on my internal disk to experiment with removing the symlinked ~/.cocoapods directory and that resulted in much more acceptable behavior. Without the symlink, the disk usage drops drastically to:

    $ cd ~/.cocoapods/repos/master
    $ du -d 1 -h
    420M    ./.git
    538M    ./Specs
    959M    .
    

    This is on MacOS Sierra (10.12.2). Hope this helps someone facing a similar situation.