Delete2Archive – Archive Gmail Messages Using the Delete Key in macOS Mail

11 November 2013Apple

One of the new features in the Mail app in macOS Mavericks was better integration for Gmail accounts. Although the so-called enhancements got off to a shaky start, Apple released a patch to fix a majority of the issues. After adjusting my Gmail settings to show my All Mail folders, things worked pretty well for my Gmail accounts in Mail on macOS – except for one nagging issue.

I am an email hoarder and prefer to archive my Gmail messages rather than delete them. Prior versions of Mail were great for this, as hitting the delete key would simply remove the Inbox label from any message that was selected – in other words it would archive the message. Unfortunately, in macOS Mavericks the delete key started behaving differently, moving selected messages to the Trash.

I searched high and low for a solution to this annoyance and found a reasonable solution that relies on a program called Keyboard Maestro. The only problem with this solution is that Keyboard Maestro charges $36 USD for a license. That isn’t too unreasonable if you plan to use its other powerful features, but all I wanted was my delete-to-archive behaviour back in Mail. Frustrated with the lack of affordable options, I did some research into Mail plugins and created a simple solution to my problem.

Delete2Archive Plugin for Mail in OS X

Delete2Archive is a plugin for Mail in macOS that brings back the old delete key behaviour for Gmail accounts, archiving messages instead of moving them to the trash!

Installation Instructions
  1. Quit Mail.

  2. Download the latest version of the plugin (compatible with macOS 10.12.1 Sierra):


    or download for free.

  3. Extract the Delete2Archive.mailbundle folder from the zip file and move it to

    ~/Library/Mail/Bundles/
    

    (where ~ indicates your home folder). To open the Library folder in Finder (it is hidden by default), hold down the Option key while selecting the Go menu, then select the Library menu item. If you don’t have a Bundles folder, see the additional instructions below.

  4. Restart Mail.

Update

Some users have had issues installing the plugin because they don’t have a Bundles folder as described in step 3 of the installation instructions. If you have never installed a Mail plugin before, you may need to follow these additional steps prior to installing the Delete2Archive plugin:

  1. Using Finder, navigate to
    ~/Library/Mail/
    

    and create a new folder called Bundles. To get to the Library folder (it is hidden by default), hold down the Option key while selecting the Go menu, then select the Library menu item.

  2. Open the Terminal app.

  3. Enter the following two commands, hitting the enter key after each one. This step adjusts some behind-the-scenes settings in Mail so that it checks for plugins each time it launches.

    defaults write ~/Library/Containers/com.apple.mail/Data/Library/Preferences/com.apple.mail.plist EnableBundles -bool true
    
    defaults write ~/Library/Containers/com.apple.mail/Data/Library/Preferences/com.apple.mail.plist BundleCompatibilityVersion -int 4
    

The plugin is very simple – it listens for delete key events and translates them into archive actions (the equivalent of selecting Message > Archive in the Mail menu) – so there are no preferences or customization options. If you decide you don’t want to use the plugin down the road, simply move the Delete2Archive.mailbundle folder to the trash and restart Mail. As this is my first attempt at a Mail plugin, it might not work perfectly for everyone. If you run into any issues, please leave a comment below or get in contact with me.

Update 2

The plugin must be updated for compatibility with each update to macOS. The current version can be downloaded above (see the Installation Instructions) and prior versions of the plugin are listed below for reference:

Update 3

When Apple released macOS 10.9.2, I received several messages from Gmail users stating that the pre-Mavericks delete key behaviour was reinstated in Mail. I did some testing and it appeared that this was the case for my installation as well. Unfortunately, I also got messages from users thanking me for updating Delete2Archive because they still needed it to archive messages in macOS 10.9.2 with the delete key.

Having used macOS 10.9.2 for more than three months without Delete2Archive, I am now confident that Apple has corrected the behaviour and it is possible to archive Gmail messages using the delete key in Mail without any plugins. That said, for those that choose to continue using Delete2Archive, I will maintain it for the foreseeable future. Before you install the latest version, perhaps it is worthwhile to take a few minutes to test your system to see if you actually still need it?

Update 4

Delete2Archive was originally created to address an issue specific to Mail running on macOS 10.9 Mavericks, but with the release of macOS 10.10 Yosemite I’ve had numerous requests to continue updating the plugin. As such, I’ve gone through the contents of this page and updated several references to ‘macOS Mavericks’ to instead read ‘macOS’ so that the information is applicable to all versions of the operating system.

Update 5

With the release of macOS 10.11 El Capitan came a series of tweets and emails from users requesting an update to the Delete2Archive plugin. After some limited testing, my Gmail accounts continue to work properly in Mail without the need of the plugin (as they have since macOS 10.9.2). If you’re still using Delete2Archive, I strongly suggest you test your system to see if you can get your Gmail accounts archiving natively. Specifically, you can try unchecking the “Move deleted messages to the Trash mailbox” option under Preferences > Accounts > Mailbox Behaviors. For those that still legitimately need the plugin, it has been updated for compatibility with macOS 10.11 El Capitan.

Update 6

With the release of macOS 10.12 Sierra I ran into some unexpected issues when trying to update Delete2Archive. For all prior macOS releases, the only change necessary for the plugin to become compatible was updating a list of plugin compatibility UUIDs in a plist file within the Delete2Archive mailbundle. However, that simple tweak did not work with macOS 10.12 Sierra. Fortunately, I was eventually able to lean on the work of smarter developers that discovered that in macOS Sierra there was a name change required to the array of compatibility UUIDs. After making that change and doing some initial testing, Delete2Archive seems to be working again.

However, I would strongly reinforce my prior suggestion that you try to get Mail.app working natively to archive your messages without the need of this plugin as Mail.app has come a long way since macOS 10.9 Mavericks in terms of Gmail support and I have not used Delete2Archive myself since macOS 10.9.2. In macOS 10.12 Sierra, there are now specific settings under Preferences > Accounts > Mailbox Behaviors that allow you to map your Gmail folders to their Mail.app equivalents, including the Archive mailbox. Please give it a try before downloading the latest version of Delete2Archive!

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Add A Comment