From 43FoldersWiki

Jump to: navigation, search

[edit] iCal2Remind.pl OSX HOWTO

I was asked by a Mac user how to get ical2rem.pl working on her Mac. I'm a Linux and (choke) Windoze guy, but luckily I had bought a Mac mini for my wife. So this is what I did to get ical2rem.pl working on the Mac mini. YMMV

(This is OSX 10.3 on a Mac mini)

UPDATE: ical2rem.pl has been updated, and now works slightly differently. Specifically, it now expects it's ICS input from STDIN. See ICal2Rem for more details.

$ echo $PATH
$ cat >> .bash_profile
export PATH
$ source .bash_profile
$ echo $PATH

The first line shows your current path. If /usr/local/bin is already in your path, this is unecessary. The second line appends whatever you type until you type Ctrl-d to the file .bash_profile, creating it if it does not exist. Be sure to use the >>, not >, otherwise you'll wipe out the file if it exists. .bash_profile will be run whenever you open a terminal. The 'source' command just loads taht file, as if you had just logged in. Now when you type 'remind -h', you get:

$ remind -v

REMIND 03.00.24 (English version) Copyright 1992-1998 David F. Skoll
Copyright 1999-2005 Roaring Penguin Software Inc.
Usage: remind [options] filename [date] [time] [*rep]


now, if it doesn't already exist, create local/bin. If you do the Unix 3-step (./configure, make, make install) but don't have permission to write to /usr/local/bin, you can do
$ ./configure --prefix=local 
instead and the binaries will be installed into your personal bin directory, which is now in your path.
mkdir -p local/bin

Now copy the ical2rem.pl to local/bin/ical2rem.pl. There are many ways to do this, I copied the entire text at http://jalcorn.net/ical2rem.pl.txt to the clipboard and then

$ cat > local/bin/ical2rem.pl

Then I pasted the text and hit Ctrl-d.

You won't be able to execute it until you turn on the execute permissions:

$ chmod a+x local/bin/ical2rem.pl

Now when you try to execute ical2rem.pl, you may get something like the following:

$ ical2rem.pl
Can't locate iCal/Parser.pm in @INC (@INC contains: /System/Library/Perl/5.8.1/darwin-thread-multi-2level /System/Library/Perl/5.8.1 /Library/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1 /Library/Perl /Network/Library/Perl/5.8.1/darwin-thread-multi-2level /Network/Library/Perl/5.8.1 /Network/Library/Perl .) at ./local/bin/ical2rem.pl line 38.
BEGIN failed--compilation aborted at ./local/bin/ical2rem.pl line 38.

If so, the libraries 'use'd at the top of ical2rem.pl:

use iCal::Parser;
use Data::Dumper;
use Time::Local;
use DateTime;

are not installed. If not, you'll need to become root. Either:

$ su -

Or open Pseudo, and drop the Terminal app on the Pseudo window.

Now your prompt should be # instead of $.


I didn't have the developer tools installed. I put in the disc that came with the Mac mini, Chose "XCode Tools" and clicked on "xcodetools.mpkg". It install all the relevant developer tools. DO THIS BEFORE RUNNING CPAN. Otherwise you will experience the -- NOT OK pain. I ended up having to edit the CPAN Config.pm file to explicitly tell it where 'make' was, because it didn't exist when I first ran CPAN.

# FTP_PASSIVE=1 perl -MCPAN -e shell

The FTP_PASSIVE=1 is only necessary if you are behind a firewall that doesn't allow active FTP. It's safe to use regardless.

If you have never run CPAN, it will ask a LOT of configuration questions, which are beyond the scope of this article. MOST you can take the defaults or obvious answers. When it asks for which servers to use, pick 2 that look like they might be close to you. THe only tricky bit is if you have to use a proxy.

If it tells you to "install Bundle::CPAN", do so.

Now for what we wanted in the first place. Note that these will also install many prerequisite packages:

# FTP_PASSIVE=1 perl -MCPAN -e shell
cpan> install iCal::Parser
cpan> install Data::Dumper
cpan> install Time::Local
cpan> install DateTime

I edited the program to change the value of $cal_dir to "Library/Calendars" and then:

$ ical2rem.pl
MSG Calendar ToDos:%"%"%
REM MSG %"%"%
MSG Calendar Events:%"%"%
REM Sep 9 2006 +3  AT 14:15 MSG %a %2 %"test%"%
$ ical2rem.pl > .remical
$ echo "include .remical" >> .reminders
$ rem
Reminders for Saturday, 9th September, 2006 (today):

Calendar ToDos:

Calendar Events:
today at 2:15pm test

Now use crontab -e to add a crontab entry to update your remical file as often as you want.

Personal tools