Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7629973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:58:42+00:00 2026-05-31T05:58:42+00:00

I built the Command Line tool (Foundation) template in Xcode. It just logs Hello

  • 0

I built the Command Line tool (Foundation) template in Xcode. It just logs “Hello World” to the console.There is only one class in it main.m. Here’s the code:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])

{

   @autoreleasepool {

       // insert code here...
       NSLog(@"Hello, World!");

   }
   return 0;

}

Now I want to run it as a daemon and log “Hello World” to the console every 10 seconds. So I moved the product/binary to /tmp on my Mac. I created the following plist for launchd:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>helloDaemon</string>
    <key>ProgramArguments</key>
    <array>
        <string>/tmp/helloDaemon</string>
    </array>
    <key>StartInterval</key>
    <integer>10</integer>
</dict>
</plist>

I loaded the plist using launchctl, but I do not see any “Hello World”s in the console. Instead, I get this:

11/03/2012 00:55:35.141 com.apple.launchd: (helloDaemon) Throttling respawn: Will start in 1 seconds
11/03/2012 00:55:45.141 com.apple.launchd: (helloDaemon) Throttling respawn: Will start in 2 seconds
11/03/2012 00:55:55.140 com.apple.launchd: (helloDaemon) Throttling respawn: Will start in 3 seconds

So what’s going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:58:43+00:00Added an answer on May 31, 2026 at 5:58 am

    NSLog is not working because when you launch a demon process it does not have any standard io sockets or file handles attached to it. They have to be specifically allocated. A good resource for how to create a proper daemon and how to write the console and syslog is provided in the book “Advanced Mac OS X Programming (chapter 20) by Dalrymple & Hillegass.

    They have define a skeleton program that addresses the io issues you highlight. I remembered reading it a while ago and thought that maybe someday I’d need it. The authors show a sample using the syslog.h lib using openlog() and syslog() for simple communications. They also show some other lower level methods for communication to files and even sockets (for servers, etc).

    I always appreciate when someone can tell me how to do something rather than reference something, but in this case, that is the best I can do. good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a Command Line Tool project in Xcode, and just want to
Is there a built-in command or tool that can reflow C# comments in Visual
The command line tool to build Xcode projects, xcodebuild, has a new build action
Is there an existing PHP, Javascript, or even command line tool that can build
I am trying to run in command line tool the following code: #import <Foundation/Foundation.h>
When i compile my app with the command line tool xcodebuild (XCode 4.2.1 -
is there a simple way to create a command-line tool in Objective C? I'd
I've build a command-line tool in Java, which I would now like to profile
I have an application which is built from command line (ANT) using J2ME Polish.
Currently I am using a post-build event command line similar to this one: xcopy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.