/dev/trouble
Eric Roller's Development Blog

Quite often I find myself in the Terminal and want to open Xcode with the project in the current directory:

% open CurrentProject.xcodeproj

This works just fine, of course, but with the following alias (added to ~/.cshrc), I don't need to know the name of the project, assuming there is always only one project in the current directory:

% alias xcode '\ls | grep xcodeproj | xargs open'
% xcode

N.B. The use of \ls ignores the alias that I have for 'ls'. Instead of ls *.xcodeproj, the pipe via grep avoids errors like "ls: No match.".

P.S. Knowing the name of the project is actually not the problem; since there are multiple items named "Current" or "CurrentProject" in the same folder, the issue is that I can't just type open SHIFT+C<TAB><CR> (where pressing TAB autocompletes the name); instead, I have to type: open SHIFT+C<TAB>SHIFT+P<TAB>.x<TAB><CR>.

Update

The Xcode text editor invocation tool xed can achieve much the same thing; just type:

% xed .

While it is convenient to add applications to the Login Items* list, it is also annoying when it takes ages for all of them to launch before you can do any meaningful work.

(*) In the Settings applications, select Accounts, your account and then the Login Items tab.

It occurred to me that one or the other application does not need to be available at login, but it would be nice to load it later. For instance, I don't use Skype during the day, but more in the evenings to contact my friends. So how about launching Skype at 5 p.m.?

The following launchd specification will do exactly that: launch Skype at 5 p.m. (or when not possible, whenever you log in next time):





        Label
        com.skype.skype
        ProgramArguments
        
                /usr/bin/open
                /Applications/Skype.app
        
        StartCalendarInterval
        
                Minute
                0
                Hour
                17
        


Save this file as ~/Library/LaunchAgents/com.skype.skype.plist (note that the Label must correspond to the file name) and wait for magic to happen when you log in next time...

One sign to check whether the monthly scripts have been executed is to look at the log file in /var/log/monthly.out. If that file were missing of if it did not show results from regular monthly runs, then here's why:

The default setup is to execute the scripts on the first of every month at 5.30 a.m. To change that on Mac OS X, you will want to modify this file: /System/Library/LaunchDaemons/com.apple.periodic-monthly.plist

[Update: If the plist uses Interval and GracePeriod then don't change it; it is already solved].

An old trap that I keep to be falling into is this one:

> find . -name "Frameworks" -prune -or -name "Info.plist"
./Frameworks
./Info.plist

Notice how the Frameworks folder is also returned (since -prune defaults to true), but the intention was to exclude it! The solution is to add -print:

> find . -name "Frameworks" -prune -or -name "Info.plist" -print
./Info.plist