Open Terminal from Xcode

itscoderslife

Coder

Posted on April 21, 2018

Open Terminal from Xcode

I love Xcode as an IDE for macOS and iOS development. But it has its own set of limitations. One feature I miss a lot is Opening a Terminal window from the Xcode into the same directory of the project. This will save lots of time.

Every time you want to run a git command or cocoapods or say any xcode build command – Opening a Terminal manually and changing the directory to the project directory takes at the least 30 seconds to a minute. Now what if I say you can do this

Now, What if I say you can open a Terminal window and get to the project directory in 1 second or say with a shortcut key?

YES! One shortcut.

This is how you do it. It’s a one time setup.

  1. Create a 2 line shell script and give the file execute permission.
  2. Go to Xcode Preferences.
  3. Add a Behavior in Xcode. Name it and give a shortcut key.
  4. On the right side details pane check the Run option.
  5. From the adjacent drop-down menu choose the script you just saved in step 1.

Here’s the video on how to do it.
https://www.youtube.com/watch?v=MMeu3xeXZxM

Script:

#!/bin/bash
open -a Terminal "
pwd"

Command to give execute permission:

chmod +x /path/to/the/open_terminal.sh

If you are lazy like me here’s the gist, download and use it: https://gist.github.com/itsdamslife/9532d757676b1f3c9b25f3959128367c

Hope this is helpful.

Happy coding 😉

inspiration courtesy: The in-built Terminal of Visual Studio Code by Microsoft

-- Happy Coding :)

💖 💪 🙅 🚩
itscoderslife
Coder

Posted on April 21, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Open Terminal from Xcode
ios Open Terminal from Xcode

April 21, 2018