74

I've installed Xcode 4.2.1 on Mac OS X Lion.

When I create a new (Mac OS X Cocoa) project and I click "Run", Xcode says build succeeded, but doesn't run the project. No errors, but no application either.

When I do exactly the same thing on another Mac (but with OS X Snow Leopard and Xcode 4.0.1 installed), the created app starts bouncing in the dock and shows an empty window, like I would expect.

When I look in the Console, there seems to be nothing strange going on. I tried reinstalling Xcode, deleting everything related to Xcode, but still no luck.

Anyone got an idea what could be the problem?

(I tried running an existing project which used to work, but that didn't show anything either)

Thanks.

App Dev Guy
  • 5,396
  • 4
  • 31
  • 54
Bas
  • 4,628
  • 1
  • 14
  • 16

10 Answers10

254

I had a similar problem with Xcode 4.5.2.

To fix it I had to go to the menu Product > Edit Scheme... > Select "Run " (in the sidebar) > Info (tab). In here is a drop down box labeled Executable, select it and choose your app that you wish to launch when the Run button is clicked.

Chad Marmon
  • 2,763
  • 1
  • 13
  • 11
  • 1
    Thanks Chad - Same here. It occurred when I changed the App's name for some reason.. – Ralpharoo Feb 10 '14 at 20:24
  • Thanks, but when Xcode "builds" my product (containing a `Makefile`), it doesn't really generate an executive, like `make` in command line would do. In this case how would i choose my executive? – Sibbs Gambling Oct 28 '15 at 04:07
  • I believe you would just use the "None" option since you are just building and not running anything. – Chad Marmon Oct 29 '15 at 05:09
  • I just ran into this after duplicating a target. The selected executable in the dropdown must default to null, which makes sense because you haven't yet built. – Will Jan 27 '16 at 20:56
  • 1
    I have tried all steps but nothing useful to me. But FINALLY I have found solution myself : In my case it works like a magic : Go to product>edit scheme > select run with info tab and un-check Debug executable . Magic started!! Run project again. I hope it should work in your case also. Thanks All... – Ravi Jun 06 '17 at 20:31
  • This changed without any warning in my Xcode 10.1 project. I have never seen this setting (hence it was always set). I'm convinced Xcode is really an "Edgar suit", the makers are from Hiveworld. – Cerniuk Mar 02 '19 at 13:52
8

I messed up my settings and had this same issue - builds the app but doesn't launch (either in the simulator or the device).

The answer Product > Edit Scheme got me half way there - then choose Run {your app} on the left. There is a launch Automatically radio button to check: enter image description here

cardmagik
  • 1,698
  • 19
  • 17
5

I had the same issue in late 2017 with Xcode 9.2.Uncheck 'Debug Executable'

I had to uncheck 'Debug Executable' and then my app was able to both run and stop.

You can open the settings by clicking Product -> Scheme -> Edit Scheme...

Josiah
  • 91
  • 2
  • 8
  • Now you can run your app, but how can you debug it? I still have this problem in a project with Xcode 11. – Dirk Mar 27 '20 at 06:24
  • In order to debug the app that was build in an old project, I had to change the build setting DEPLOYMENT_POSTPROCESSING to No (it was set to Yes for some reason, default is No). – Dirk Mar 27 '20 at 06:46
3

Simple

Select the desired active scheme and device/simulator from the toolbar (next to the "play" and "stop" buttons).

The scheme selection should look something like below where the name is that of the appropriate target.

Set proper scheme and device/simulator.

Old McStopher
  • 6,295
  • 10
  • 60
  • 89
2

I know this is a well accepted answered question, however for those who are building / running on a physical device

SOLUTION: Hard-restart the device, then clean the project in Xcode ⇧+⌘+K.

I think the bundle gets confused causing Xcode to "think" it already ran the project, therefore showing "Finished" instead of launching whichever application you selected to run.

Will Von Ullrich
  • 2,129
  • 2
  • 15
  • 42
2

Xcode 10.2

Steps:

  1. Product -> Scheme -> Edit Scheme
  2. Run
  3. Info
  4. Executable -> Yourproject.app
  5. Run whole project again

Screenshot: enter image description here

Jerry Chong
  • 7,954
  • 4
  • 45
  • 40
2

Check if your project has entitlements enabled. Sandbox or iCloud or both.

If you have that enabled and you dont have an appropriate cert from the Dev portal your app will build but not launch.

Switch the entitlements off if you are not actively developing functionality around them.

The Console app will show this up as a permissions failure. But oddly not the Xcode debug console.

Warren Burton
  • 17,451
  • 3
  • 53
  • 73
  • Nope, it doesn't have Entitlements enabled. Neither the Xcode Debug console nor the Console app show any strange things happening to my project. – Bas Nov 24 '11 at 18:38
  • Just had this scenario, it drove me insane. I had to remove the entitlements and create them again to make it work. It all started when xcode8.1 messed with my tests target and i had to recreate the entire project and i moved the entitlements to a custom folder. Next time leave them where xcode creates them. – Cristi Băluță Nov 17 '16 at 07:32
0

I had similar problems. I found that the problem was in ~/.gdbinit file. And a second time - at the window initialization function loadWithNibName/initWithWindow (wrong name nib file or frame properties). Also check the file Info.plist in your project (parameters "Main nib file base name" and "Principal class").

Vladislav
  • 165
  • 1
  • 5
  • 15
0

Do you have the correct project selected to run?

Click on the project name next to the stop button (top left). Are there multiple projects listed? Do you have the correct one selected?

kmiklas
  • 13,085
  • 22
  • 67
  • 103
-1

Try removing the dev tools by running

sudo Developer/Library/uninstall-devtools --mode=all

in Terminal. This will properly remove all components of the dev tools, including the command-line components.

You can then try a re-install.

Rob Keniger
  • 45,830
  • 6
  • 101
  • 134