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
CalendarSync
project 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
CalendarSync
binary is underProducts/usr/local/bin/
. - You can copy the
CalendarSync
executable 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→[email protected]"
--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→[email protected]" --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_name
to your agent's name:Label
StandardOutPath
StandardErrorPath
- For example,
com.danyreyna.calendarsync.outlook_to_gmail
.
- Configure the
ProgramArguments
key:- Edit the path to
CalendarSync
. You can copy theCalendarSync
executable file to your home directory for simplicity. - Edit the source and target calendars.
- 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
.
- 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
StartCalendarInterval
key to your liking.
- Move your
plist
file 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
plist
intolaunchd
.
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
plist
fromlaunchd
.
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
plist
file with your new configuration. - Load the
plist
intolaunchd
.
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
plist
fromlaunchd
.
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
plist
file 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