Deploy a Swift OS X app locally?

Edit: while this answer still works, it targets old Xcode versions and uses the debug version of your executable. For recent Xcode versions, and for using the release version of your executable, see JeremyP's answer.

Each time you build an OS X application with the current scheme, Xcode automatically populates the "Products" folder with the related app bundle.

You can find this folder in the Project Navigator:

Xcode > Project Navigator > "Products" folder

Your .app is in there and ready to be used and/or copied to the /Applications folder.

enter image description here


On the Product menu there is an Archive option. Select that to create an archive of your app.

Xcode should then automatically open the Organiser window with the archive of your app selected.

You'll see a big blue button called Upload to App Store on the right with two smaller buttons below it. The one you want is called Export... Press it and you'll get a pane giving you various export options with different kinds of signing.

The bottom option creates an unsigned .app file which you can put in your Applications directory.

NB As Eric D says, you can just drag the app out of the products directory, but unless you edit the scheme, that will give you a debug build with less optimisation and with asserts activated.

Update for Xcode 11.2

As Bell B. Cooper points out, the process has changed slightly. Now when you archive an app, you get a window listing the apps and a big blue "Distribute" button. Pressing this, gets you a dialog box giving you the various options. Which one you choose depends on what you want to do with the executable. With Catalina, unless it's just for your own use, you probably want to go for one of the options that involves signing the app.

enter image description here

Tags:

Macos

Xcode

Swift