Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy a Swift OS X app locally?

Tags:

xcode

macos

swift

I am not new to programming, but I am new to Swift. I have developed a small app that I have no intention of distributing, I just want to use it for myself. Everything works just as desired in XCode and now I want to deploy that app locally. How can I run my app on my machine without needing to have XCode also running? I just want to see my app in my Applications folder and run it when I want. Does XCode put build files somewhere that I can access them and use outside of XCode?

like image 454
Unknown Coder Avatar asked Feb 18 '16 16:02

Unknown Coder


People also ask

Can I develop on Mac without Xcode?

Non-native platforms, like Flutter or React Native, won't make iOS builds without Mac either. Storyboards can be edited only in Xcode, so development without Xcode means development without Storyboards. Alternative IDEs for iOS development require Xcode. You don't need to run it, but you should have it installed.


2 Answers

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

like image 105
JeremyP Avatar answered Oct 22 '22 17:10

JeremyP


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

like image 26
Eric Aya Avatar answered Oct 22 '22 18:10

Eric Aya