arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Autostart Server After Crash

This document will guide you on how you can configure your Mac to automatically restart the BlueBubbles Server app if the app crashes (unsafe exit)

circle-info

Special thanks to Scr0ncharrow-up-right for the basis of this guide!

  1. Open the TextEdit app on your Mac

  2. Copy & paste the following XML into the new text file: Note: Modify the "Program" string value to the location of your BlueBubbles.app, and/or replace {username} with your macOS username

    This will make sure that the specified program will be run when you first login to your Mac (RunAtLoad), and will be restarted if it crashes (KeepAlive). The SuccessfulExit: false flag means that the app will not be restarted if the server exits successfully; for example, if you manually close the app.

  3. Save the file to ~/Library/LaunchAgents/com.bluebubbles.server.plist

    1. CMD + S to save the file

    2. CMD + Shift + G to open a file location

  4. Disable the built-in autostart option in the BlueBubbles Server:

  5. Install the launch agent and load it after the current user graphically logs in:

  6. Immediately start the launch agent (only necessary for the first time):

Some additional notes:

  • To uninstall the launch agent:

  • To print information about the launch agent:

Paste ~/Library/ into the popup and hit Enter

  • Find the LaunchAgents folder and open it

    • If it does not exist, create it using the New Folder button

  • Enter com.bluebubbles.server.plist in the Save As field

  • <?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">
        <dict>
            <key>Label</key>
            <string>com.bluebubbles.server</string>
            <key>Program</key>
            <string>/Users/{username}/Applications/BlueBubbles.app/Contents/MacOS/BlueBubbles</string>
            <key>RunAtLoad</key>
            <true/>
            <key>KeepAlive</key>
            <dict>
    	    <key>SuccessfulExit</key>
    	    <false/>
    	</dict>
        </dict>
    </plist>
    launchctl bootstrap gui/$(id -u $(whoami)) ~/Library/LaunchAgents/com.bluebubbles.server.plist
    launchctl kickstart gui/$(id -u $(whoami))/com.bluebubbles.server
    launchctl remove com.bluebubbles.server
    launchctl print gui/$(id -u $(whoami))/com.bluebubbles.server