Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Git post-checkout hook to install CocoaPods
#!/bin/bash
#
### CocoaPods git-checkout hook
#
# This is a hook which you can install, it will automatically
# run `pod install` when you do a git pull/clone/checkout.
#
# The hook can be used to make CocoaPods usable with Xcode CI.
#
## Installation
#
# This git post-checkout hook can be installed by running the
# following command. Note, you will need to re-install this
# everytime you update Xcode.
#
# $ [sudo] curl -o /Applications/Xcode.app/Contents/Developer/usr/share/git-core/templates/hooks/post-checkout https://gist.github.com/kylef/7250271/raw/post-checkout.sh
# $ [sudo] chmod +x /Applications/Xcode.app/Contents/Developer/usr/share/git-core/templates/hooks/post-checkout
#
if [ -r Podfile ] ; then
env -i HOME=/Library/Server/Xcode PATH=$PATH pod install
fi
@andrewtheis

This comment has been minimized.

Copy link

commented Jan 6, 2014

Anything else required to get this to work other than running the two commands above?

@CBeloch

This comment has been minimized.

Copy link

commented Jan 10, 2014

not working here either :(

@bitwit

This comment has been minimized.

Copy link

commented Feb 2, 2014

This has worked for me as of this week. I think a key piece of information could be that this only works on clean builds because it needs to be a checkout, not just a pull

@jdelStrother

This comment has been minimized.

Copy link

commented Feb 6, 2014

Yeah, if you run this after your project has already been checked out, you'll need to copy the hook to the checked-out directory (eg /Library/Server/Xcode/Data/BotRuns/Cache/53906ff4-7456-4d8c-ad7c-b05d7800095c/source/Users/jon/blah/.git/hooks/). Look in your logs to figure out what directory it's running in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.