Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm a recent convert from Windows to Macbook Pro. I am getting use to Xcode. One thing that I would enjoy is when running a debug application in the terminal. Currently, I have to press Command+R for it to compile and run in Xcode. To have the application run in the terminal, I have to do an additional step by opening the Products folder, right click the application, then 'Open as Exterior Editor'. Then the terminal opens and runs the program.

I would like this behavior to work automatically by pressing Command+R. It seems to me like there would be a setting to direct the output.

Are there any steps to accomplish this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
864 views
Welcome To Ask or Share your Answers For Others

1 Answer

First, make a new scheme (or edit the current one) and change the executable to Terminal.app:

Scheme Info

Then, under the "Arguments" tab, make sure "Base Expansions On" is set to your App. Then put open -a ${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}

Scheme Arguments? ?

The command will get expanded to something like open -a /Users/Me/Library/Developer/Xcode/DerivedData/MyProj-abcdefghijklmnopqrrstuvwxyz/Build/Products/Debug-iphonesimulator/Universal.app

open -a is how you open an App from the command line.

Edit: Use ${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME} instead (see comments).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...