Sync events from one calendar to another. Synchronize all events from today's start up-to 30 days from now, including instances of recurring events.
For CalendarSync to work, you must have your calendars enabled in System Settings/Internet Accounts.
Also, you can install launchd agents to synchronize your calendars automatically.
- Open the
CalendarSyncproject in XCode. - At the top, select the "Any Mac" run destination.
- Select
Product -> Build For -> Running. - Select
Product -> Archive. - Right-click the archive, click "Show in Finder".
- Right-click the
.xcarchive, "Show Package Contents". - The
CalendarSyncbinary is underProducts/usr/local/bin/. - You can copy the
CalendarSyncexecutable file to your home directory for simplicity.
Follow the account_name→calendar_name format.
CalendarSync uses the → arrow character as a separator as it has a low probability of appearing in a calendar's name.
If you're unsure of what names to use, you can get them from Calendar.app.
./CalendarSync "source_account_name→source_calendar_name" "target_account_name→target_calendar_name" [--dry-run]
Example:
./CalendarSync "outlook→Calendar" "gmail→somename@gmail.com"
--dry-run is an optional argument you can use to see what events CalendarSync would create and delete, if any.
Example:
./CalendarSync "outlook→Calendar" "gmail→somename@gmail.com" --dry-run
Give it a unique name.
cp com.danyreyna.CalendarSync.plist com.danyreyna.calendarsync.some_sync_agent_name.plist
For example:
cp com.danyreyna.CalendarSync.plist com.danyreyna.calendarsync.outlook_to_gmail.plist
- Edit the following keys to change
some_sync_agent_nameto your agent's name:LabelStandardOutPathStandardErrorPath- For example,
com.danyreyna.calendarsync.outlook_to_gmail.
- Configure the
ProgramArgumentskey:- Edit the path to
CalendarSync. You can copy theCalendarSyncexecutable file to your home directory for simplicity. - Edit the source and target calendars.
- Follow the
account_name→calendar_nameformat. CalendarSyncuses the→arrow character as a separator as it has a low probability of appearing in a calendar's name.- If you're unsure of what names to use, you can get them from
Calendar.app.
- Follow the
- Edit the path to
- You can also uncomment the
--dry-run<string>tag for testing and debugging purposes. - By default, the agent will run every hour from 8am to 5pm. Edit the
StartCalendarIntervalkey to your liking.
To prevent race conditions when synchronizing events from calendar A to calendar B and also from calendar B to calendar A, edit StartCalendarInterval in one of your two agents so they don't run simultaneously.
For example, agent X may run hourly on the hour (8:00, 9:00, etc.) and agent Y may run with a few-minute offset (8:02, 9:02, etc.).
- Move your
plistfile to your user's launch agents directory.
mv com.danyreyna.calendarsync.some_sync_agent_name.plist ~/Library/LaunchAgents/com.danyreyna.calendarsync.some_sync_agent_name.plist
For example:
mv com.danyreyna.calendarsync.outlook_to_gmail.plist ~/Library/LaunchAgents/com.danyreyna.calendarsync.outlook_to_gmail.plist
- Load the
plistintolaunchd.
launchctl load ~/Library/LaunchAgents/com.danyreyna.calendarsync.some_sync_agent_name.plist
For example:
launchctl load ~/Library/LaunchAgents/com.danyreyna.calendarsync.outlook_to_gmail.plist
- Verify it loaded correctly.
launchctl list | grep com.danyreyna.calendarsync.some_sync_agent_name
For example:
launchctl list | grep com.danyreyna.calendarsync.outlook_to_gmail
cat /tmp/com.danyreyna.CalendarSync.some_sync_agent_name.out | tail
For example:
cat /tmp/com.danyreyna.CalendarSync.outlook_to_gmail.out | tail
cat /tmp/com.danyreyna.CalendarSync.some_sync_agent_name.err | tail
For example:
cat /tmp/com.danyreyna.CalendarSync.outlook_to_gmail.err | tail
- Unload the
plistfromlaunchd.
launchctl unload ~/Library/LaunchAgents/com.danyreyna.calendarsync.some_sync_agent_name.plist
For example:
launchctl unload ~/Library/LaunchAgents/com.danyreyna.calendarsync.outlook_to_gmail.plist
- Edit the
plistfile with your new configuration. - Load the
plistintolaunchd.
launchctl load ~/Library/LaunchAgents/com.danyreyna.calendarsync.some_sync_agent_name.plist
For example:
launchctl load ~/Library/LaunchAgents/com.danyreyna.calendarsync.outlook_to_gmail.plist
- Verify it loaded correctly.
launchctl list | grep com.danyreyna.calendarsync.some_sync_agent_name
For example:
launchctl list | grep com.danyreyna.calendarsync.outlook_to_gmail
- Unload the
plistfromlaunchd.
launchctl unload ~/Library/LaunchAgents/com.danyreyna.calendarsync.some_sync_agent_name.plist
For example:
launchctl unload ~/Library/LaunchAgents/com.danyreyna.calendarsync.outlook_to_gmail.plist
- Remove the
plistfile from your user's launch agents directory.
rm ~/Library/LaunchAgents/com.danyreyna.calendarsync.some_sync_agent_name.plist
For example:
rm ~/Library/LaunchAgents/com.danyreyna.calendarsync.outlook_to_gmail.plist
- Remove the log files.
rm /tmp/com.danyreyna.CalendarSync.some_sync_agent_name.out
rm /tmp/com.danyreyna.CalendarSync.some_sync_agent_name.err
For example:
rm /tmp/com.danyreyna.CalendarSync.outlook_to_gmail.out
rm /tmp/com.danyreyna.CalendarSync.outlook_to_gmail.err