Now every time when you build your project build number will increase. Of course you can always change it manually and it will continue increasing like it should.

Here is small explanation what this script do:

buildNumber is shell variable where we will store build number from XCode. To be able to read it from Project-Info.plist file we need to use small tool from Apple, called PlistBuddy. It’s included by default but it’s not in the path and that means that we need to specify full path to it, in our case /usr/libexec. We need to specify command sent to PlistBuddy and file on which that command will be performed, in our case command is Print CFBundleVersion which is property of build number in XCode written in our Project-Info.plist file and last argument is file name which we get from variable INFOPLIST_FILE.

here we increase value of buildNumber, same like int++ but shell is a bit different so we need to write it like this for XCode to be able to run it

here we run PlistBuddy with command Set where we say to it what to set and where, in our case we use CFBundleVersion increased by one and we are storing it to our Project-Info.plist file