A little complain about launchctl

It’s been a quite while since my last post.

That’s because I’m working something big on PHP, I’m writing a right and agile PHP development framework right now, and it has nearly finish the alpha stage.

I’ll make it to the world and open source it when I finish it.

Here is a few features features I’d like to talk about:

  1. Based on CI (using the methodology and definitions of CI), for agile and quick development, and easy to understand or put hands on it
  2. Fully support responsive design leveraging less and bootstrap 3.0
  3. Template functions from Smarty(and lots of plugins)
  4. Very smart image responsive support, leveraging a slightly modified of jquery-piciture and php-imagick, can get the picture any size you like on the fly
  5. Very smart Datatable Master view, using jquery-datatables, integrade datatable as Master view in the deep of controllers, coding master view couldn’t be more easier
  6. Very smart alternative Listview Master View, using the same methodlogy of jquery-datatables, and have 2 modes of the responsive design
  7. AOP support for PHP, can use regex and other string tools to intercept the controller methods(for security, transaction, auditing and logging usages)
  8. Sophisticated designed security mode, can be configured using database of template file, and using AOP to do the security, without invading the code

I can make quite a long list for this.

But, I have to stop, since, this post is for a little complains about launchctl.

launchctl is the fundamental application for OS X, it handles all the deamon processes, and it can do lots of things.

I won’t state lots of launchctl here, you can view the tutorial about it here.

Here is my complain.

I use vim in work a lot. As everyone knows, vim support ctags to do the synbol navigation.

But keeping update ctags’s tag file when updated the code is quite tiresome.

So, I tried to add some auto execution scripts to let ctags update my tags file automatically after a short time interval(1 minute, for example).

Yes, I can use crontab to do this. But, since I’m using OS X(and love it so much), I want to be more appleish, so I gave launchctl a try.

I tried the example here, it is a brilliant tutorial, but, the sample it brought is not the correct one!!!!!

Here is the sample it provided:

<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
        <key>label</key>
        <string>com.devdaily.pingwebsites</string>

        <key>ProgramArguments</key>
        <array>
                <string>/Users/al/bin/crontab-test.sh</string>
        </array>

        <key>OnDemand</key>
        <false/>

        <key>Nice</key>
        <integer>1</integer>

        <key>StartInterval</key>
        <integer>60</integer>

        <key>StandardErrorPath</key>
        <string>/tmp/AlTest1.err</string>

        <key>StandardOutPath</key>
        <string>/tmp/AlTest1.out</string>
</dict>
</plist>

See the problem???

You’ll be confuse as I was.

Yes, the problem is here:

        <key>label</key>

You should use Label instead of label, or launchctl won’t recognise this plist!!!!!!

And, investigate more carefully, you can see, all the key is capitalised but the label!!!!!

Are you kidding me?!

I google about 10 minutes about this problem(or maybe 30 minutes more, since I use the time reading when the page is loading, no kidding, I’m in mainland China, and must get pass the GFW to access google, yes!)

And after that, launchctl still won’t work, it complains:

launch_msg(): Socket is not connected

This is quite a difficult problem, and quite few articles about it. Yes, when you know the answer, you can know why.

I tried to fix this problem, for about 1 hour, just reading the post or other things. Frustrated nearly gave up.

And, I came across 1 forum post(sorry, forgot the url), it says this problem can be found in iTerm2 only, and won’t in the native terminal.

I tried, and, get passed!!!!!

So, this is a defect of iTerm2. This bug nearly let me gave up OS X, thanks, at least I knew where the problem is and can get my time to do something more useful.

I don’t know if the defect has been submitted in iTerm2’s bug tracker, so I have submitted the defect to them, the defect I submitted is here

Leave a Reply