# Command Line Programs on macOS Tutorial

**URL:** <https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160>\
**Category:** 🎓 Courses & Articles\
**Created:** [September 22, 2016, 10:28am UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160 "2016-09-22T10:28:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierredrks](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pierredrks/32/104353_2.png) [@pierredrks](https://forums.kodeco.com/u/pierredrks)\
**Post date:** [September 22, 2016, 10:28am UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/1 "2016-09-22T10:28:43Z")

</div>

Discover how easy it is to get started making your own terminal-based apps with this command line programs on macOS tutorial.

* * *
 This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/1147-command-line-programs-on-macos-tutorial](https://www.raywenderlich.com/1147-command-line-programs-on-macos-tutorial)

---

<div class="post-metadata">

**Author:** ![redqueencoder](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/redqueencoder/32/76579_2.png) [@redqueencoder](https://forums.kodeco.com/u/redqueencoder)\
**Post date:** [October 23, 2016, 5:06pm UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/2 "2016-10-23T17:06:05Z")

</div>

Hi. I really wanted to thank you for writing this tutorial. I think we forget that creating command line applications is an option and it can be a really great way to do a quick and dirty application without having to worry about auto layout and interface builder.

---

<div class="post-metadata">

**Author:** ![pierredrks](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pierredrks/32/104353_2.png) [@pierredrks](https://forums.kodeco.com/u/pierredrks)\
**Post date:** [October 24, 2016, 7:39am UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/3 "2016-10-24T07:39:51Z")

</div>

@redqueencoder Thanks, i think command line applications have some other benefits too. You can chain several command line tools to get a result one single tool wouldn’t achieve and it can make it easier to create a platform independent application. Just write the tool platform independent and add a platform specific GUI application around it.

---

<div class="post-metadata">

**Author:** ![oks\_ios](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/oks_ios/32/50276_2.png) [@oks\_ios](https://forums.kodeco.com/u/oks_ios)\
**Post date:** [December 2, 2016, 11:58pm UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/4 "2016-12-02T23:58:17Z")

</div>

Hi! Thanks for your tutorial its great!  
Here is small error in example for current swift version:

```
func getOption(- option: String) -> (option:OptionType, value: String) {
  return (OptionType(value: option), option)
}

```

it should be:

```
func getOption(_ option: String) -> (option:OptionType, value: String) {
  return (OptionType(value: option), option)
}

```

---

<div class="post-metadata">

**Author:** ![mlmodel](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mlmodel/32/53896_2.png) [@mlmodel](https://forums.kodeco.com/u/mlmodel)\
**Post date:** [January 9, 2017, 1:55am UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/6 "2017-01-09T01:55:26Z")

</div>

Superb. There’s just one thing I’ve been dying to know: how do you tell Xcode where to put the executable and what to call it instead of the ridiculous cryptic files in `~/Library/Developer/Xcode/DerivedData/`?

---

<div class="post-metadata">

**Author:** ![pierredrks](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pierredrks/32/104353_2.png) [@pierredrks](https://forums.kodeco.com/u/pierredrks)\
**Post date:** [January 10, 2017, 8:25am UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/7 "2017-01-10T08:25:25Z")

</div>

Hi, you can change the location under Xcode-\>Preferences-\>Locations-\>Derived Data and maybe Advanced.  
If you want to deploy/publish your Application you should use the Menu Product-\>Archive and after the archive was created you can export your Application inside the Organizer window Export-\>Save Built Products. This will put your Application inside a folder of your choice.

---

<div class="post-metadata">

**Author:** ![brindy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/brindy/32/106685_2.png) [@brindy](https://forums.kodeco.com/u/brindy)\
**Post date:** [April 18, 2017, 7:41am UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/8 "2017-04-18T07:41:57Z")

</div>

I have a project that uses Packages.swift and I have been compiling it with `swift build` command using Xcode as my editor. However, I don’t get any auto-completion because it’s not in an Xcode project.

Is it possible to do both? It would be really handy to have auto-completion for the packages I am specifying in Packages.swift.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![bestlem](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@bestlem](https://forums.kodeco.com/u/bestlem)\
**Post date:** [May 3, 2017, 10:14pm UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/9 "2017-05-03T22:14:46Z")

</div>

Under swift in Xcode 8 you can generate an Xcode project with `swift package generate-xcodeproj`  
Then open that project with Xcode

---

<div class="post-metadata">

**Author:** ![brindy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/brindy/32/106685_2.png) [@brindy](https://forums.kodeco.com/u/brindy)\
**Post date:** [May 3, 2017, 10:41pm UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/10 "2017-05-03T22:41:13Z")

</div>

> [@bestlem](#):
>
> Under swift in Xcode 8 you can generate an Xcode project with swift package generate-xcodeproj  
> Then open that project with Xcode

Amazing, thanks! That worked.

Have been using CLion which is great, but my 30 day trial is about to run out and I don’t really want to pay for it just for a personal side project.

---

<div class="post-metadata">

**Author:** ![avantjer](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/avantjer/32/81494_2.png) [@avantjer](https://forums.kodeco.com/u/avantjer)\
**Post date:** [May 6, 2017, 8:22pm UTC](https://forums.kodeco.com/t/command-line-programs-on-macos-tutorial/20160/11 "2017-05-06T20:22:45Z")

</div>

Is it possible to use XCTest with Command Line Programs?  
It seems possible, but when I’ve tried, I haven’t been able to make it work.

Thanks…

Jerry
