终端窗口内的 Xcode? ?

是否有一个区域,我可以打开一个终端外壳会话 在里面XcodeAndroid Studio有一个窗口,你可以打开在底部的控制台 logcat窗口,将开始一个终端会话。Xcode有这样的东西吗?

89384 次浏览

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.

enter image description here

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.

  1. 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>
  2. In the Xcode menu bar, Go to Xcode -> Preferences -> Behaviors.
  3. Add a Custom behavior
  4. Name it "Open Terminal", or whatever.
  5. (Optional) Configure a hotkey for the behavior by tapping on the
  6. (Optional) Input hotkey combination
  7. Checkmark Run, select you script from step 1.
  8. Use it within Xcode.

Image with numbers corresponding to steps