Let’s Optimize the Work with Terminal for Xcode Developers.

Every iOS Developer often has to deal with things that need to be done via Terminal:

Lately I’ve often had to switch between different Xcode projects and every time I had to change a path to a specific project in terminal. I am so tired of it! I want to have the opportunity to open Terminal right from Xcode with an already specifed path. 🤔 If you feel the same then continue reading!

First, we need to create a script with the following body:

It opens either .xcodeproj or .xcworkspace.

After that don’t forget to make this script as an executable by the special command: chmod +x <your_script.sh> (you can check more about this command here) and save it to some directory wherever you want (in my case it’s a user directory).

If you prefer iTerm, just change the Terminal keyword to iTerm in this script.

The next one is creating a custom Xcode’s behavior. Open Xcode and follow the next steps: Xcode menu > Behaviors > Edit Behaviors… Then at the bottom of the popup appeared press the + button.

Choose a recognizable name for this behaviour, setup a shortcut, select theRun checkbox and select the previously configured script. You only need to configure it once and it’ll work for all your projects. 🎉

Thanks for reading! I hope you’ve enjoyed my Terminal optimization tip. If you had to face the same issue but resolved it in a different way — share your solution in the comment section below. 🙏

I during ITC build processing.

Shaggy iOS Engineer at Rosberry. Reactive, Open-Source lover and Retain-cycle detector :)

Also check my telegram channel about programming, twitter and my open-source projects: