You are using third-party tools like CocoaPods, Cathage, SPM or just having some useful script files for your project. It’s fine!
But you often found yourself in need of opening a Terminal window at the project location. It hard to tell that feeling. 🤔 Don’t worry, here is what you need to do:
Create a new text file with your favourite text editor and put this inside:
It opens either
If you prefer iTerm, just change the Terminal keyword to iTerm in this script. I’m using iTerm too, so I created a bash file like this:
Save it with a .sh extension in some permanent location where your wife or your girlfriend wouldn’t see it everyday so it annoys them, and they won’t delete it by mistake.
Navigate to the location of the script file you just created using Terminal and change its permissions using:
chmod +x <fileName>
where fileName should be replaced with the name of the .sh file you just created.
In Xcode, go to Preferences -> Behaviors and click the plus sign in the bottom to add a new behavior and name it something like “Open Terminal”
Tick only the last checkbox, where it says “Run”, and select the location of your .sh file.
Click the little ⌘ symbol to the right of your behavior name and select a new keyboard shortcut for your behavior. I recommend: ctrl+command+t.
That’s it, you’re done! 🎉 🎉 🎉
You can get my sh file here: xcode-terminal.sh