My Workflow Using Mainly Vim + Terminal to Create and Build XCode Project — Part II

Continued from Part I

This post will be focusing on xcodeproj as it’s the only thing that I’ve been stuck since the previous part.

But good news!! I can do it now! Horaaayyy!

So I’m able to add a new file into Xcode project now via xcodeproj. It’s hard at first and seems impossible to do so because I don’t really understand Ruby code before. Yes, that’s right, xcodeproj was written in Ruby code.

It’s not something you just supply parameter to the command, then get a result. It’s more like DIY. You have to do it yourself. You have to script it and tell it to do on your own terms.

xcodeproj provides the basic and essential thing to mainly manipulate Xcode project file namely (.pbxproj). When you’re done with all stuff to do i.e. adding new files under a certain group, adding frameworks, adding resource bundles and more. Then save the project; Then your .pbxproj file inside .xcodeproj folder (Xcode regards it as a file to open) will be updated and you’re good to go.

That’s the whole concept.

Thus I learn Ruby and create another script zhmanage on top leveraging the power of xcodeproj to manage our project. It’s minimal and can provide what I really need it right now. See result images below.

zhmanage listgroup will list all groups under the project

zhmanage addfile <filepath> <grouppath> will add a new file under a group inside a project. Xcode project can see the newly added file correctly.

That’s it for now. You can leverage the power of it more further. More you understand functionality of xcodeproj for which it can provide, more you can make it benefits your own project.

The management script possibly will grow over time as I might need something else. So check back there, or even fork and adapt for your own.

Until next update.

Originally published at

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.