I'm trying to create a mysqldump of a database via bash script, and automate the process by using Mac's launchd / launchctl process. I can successfully run the bash script manually to backup the db in terminal, but if I try to use launchd, nothing seems to happen.

Anyone know what might be the issue?

Here is the bash script for the mysqldump:

DT=`date +%m_%d_%Y_%H_%M_%S`
/Applications/MAMP/Library/bin/mysqldump --opt -u root -proot --host=localhost extrapolation > /Users/[user]/Desktop/db/extrapolation_$DT.sql

and here is the plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

which I've saved in /Users/[user]/Library/LaunchAgents

I then run:

launchctl load ~/Library/LaunchAgents/extrapolation_db_backup.plist`

and if I use

launchctl list

I can see the process:

-   0   extrapolation_db_backup

My guess is maybe some sort of permissions issue but I haven't been able to work it out. Any help would be appreciated.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.