Does Xcode
have an area I can open up a terminal shell session inside Xcode
? Android Studio
has a window you can open up at the bottom by the console logcat
window that will start a terminal session. Does Xcode
have anything like this?
-
3Fair enough. I guess I just like to keep it in the IDE if I can, so I don't have 2 separate windows. Really more of a preference than wanting it from a practical standpoint.– Adam JohnsFeb 25, 2014 at 14:22
-
An IDE without a built in Terminal. Think different, because it's 2021 and Apple likes to give a sh%&.– Martin BraunMar 14, 2021 at 0:11
3 Answers
Create executable shell script with the following contents and save it anywhere
#!/bin/bash open -a Terminal "`pwd`"
- Add execute permissions to your script:
$ chmod +x <YourShellScript>
- Add execute permissions to your script:
- In the Xcode menu bar, Go to Xcode -> Preferences -> Behaviors.
- Add a Custom behavior
- Name it "Open Terminal", or whatever.
- (Optional) Configure a hotkey for the behavior by tapping on the ⌘
- (Optional) Input hotkey combination
- Checkmark Run, select you script from step 1.
- Use it within Xcode.
Image with numbers corresponding to steps
-
3You missed a step - the script created in step one must have executable permission for it to be selectable in Step 7.– BoonApr 12, 2017 at 16:21
-
2
-
5For those who have not written much shell script before (like me). You will need to add
#!/bin/bash
at top of your shell file– ChengluApr 22, 2017 at 3:49 -
11. quickly create open terminal script: $
echo '#!/bin/bash\nopen -a Terminal "`pwd`"' > ~/terminal.sh && chmod +x ~/terminal.sh
2. Add Behaviour in Xcode, add shortcut ctrl+cmd+T 3. Select Run > choose terminal.sh from home directory Mar 13, 2019 at 8:06 -
Thanks for your solution, i changed Terminal to iTerm, and it works also very well.– xyzJul 11, 2019 at 1:52
Unfortunately there is no such a thing in Xcode
. We have to fall back to external Terminal
window.
If you really want to do it, you can add a build phase and run script that opens the Terminal
- but that might not be what you are looking for.
-
1
-
Useful for me: to make it open in a new tab if already have a terminal instance running you can go to Dock preferences and set
Prefer tabs when opening documents
toAlways
.– henriqueMay 9, 2019 at 20:50
Relatedly, now in Xcode 8, you can have your program run automatically in Terminal rather than using the Xcode Console. Just go to Edit Scheme > Run > Options and set Console at the bottom to Terminal.
-
No options like this for me, maybe it is platform specific/other dependencies? May 3, 2017 at 7:25
-
1That's strange. I added a picture above to show where it is. Obviously it's for OSX apps only May 3, 2017 at 15:30