Getting set up

Add Gmail to a Mac mail app with an app password

How to create a Gmail app password, turn on 2-Step Verification and enter the right IMAP and SMTP settings in a Mac mail app, with fixes for common errors.

Sanjeev Maharjan5 min read

Cover for the guide: Add Gmail to a Mac mail app with an app password

To add Gmail to a Mac mail app that asks for a password, you need a Gmail app password, not your normal one. Turn on 2-Step Verification in your Google Account, create an app password, then sign in with your full Gmail address, that 16-character password, and the servers imap.gmail.com and smtp.gmail.com.

The short version: turn on 2-Step Verification, open myaccount.google.com/apppasswords, create a password, and paste it into your mail app in place of your Google password. Incoming server imap.gmail.com on port 993, outgoing server smtp.gmail.com on port 465.

What a Gmail app password is

An app password is a 16-character code that Google makes for one app or device. Google describes it as a passcode that lets an app sign in to your account when that app cannot show Google's own sign-in window. It works in place of your password for mail, and it skips the second step, because a mail server connection has no way to ask you for a code from your phone.

Three things are worth knowing before you make one:

  • It gives the app access to your mail, so only type it into an app you trust and keep it out of notes and screenshots.
  • You can remove it at any time from the same page, which signs that one app out and leaves everything else alone.
  • Google says it revokes all your app passwords when you change your Google Account password. If your mail app stops signing in after a password change, that is why.

Google's own advice is to use an app password only when the app does not offer "Sign in with Google". Many Mac mail apps, and anything set up by hand with IMAP, do not.

Step 1: turn on 2-Step Verification

Google says app passwords can only be used with accounts that have 2-Step Verification turned on. If yours is already on, skip to step 2.

  1. Open your Google Account in a browser and go to Security.
  2. Find 2-Step Verification and select it.
  3. Follow the steps: Google asks you to sign in again and choose a second step, such as a prompt on your phone, an authenticator app or a text message.

Step 2: create the app password

  1. Go to myaccount.google.com/apppasswords and sign in if asked.
  2. Type a name that tells you later what it is for, such as "Mail on my MacBook".
  3. Select Create. Google shows a 16-character password in four groups.
  4. Copy it straight away. Google shows it once. If you lose it, delete it and make another.

The full instructions are on Google's help page, Sign in with app passwords.

No app passwords option? Google lists three reasons: your account uses 2-Step Verification with security keys only, it is a work or school account where the administrator has turned the option off, or it has Advanced Protection.

Step 3: enter the Gmail settings in your mail app

In the mail app, choose to add a Gmail account, or an IMAP account if there is no Gmail entry. Many apps fill in the servers for you. If yours asks, these are the values Google publishes.

SettingIncoming mail (IMAP)Outgoing mail (SMTP)
Serverimap.gmail.comsmtp.gmail.com
Port993465, or 587
SecuritySSL/TLSSSL/TLS on 465, STARTTLS on 587
UsernameYour full Gmail addressYour full Gmail address
PasswordThe app passwordThe same app password

The same values for iCloud and Yahoo are in the guide to IMAP and SMTP settings for Gmail, iCloud and Yahoo.

Common errors and what they mean

"Application-specific password required"

You typed your normal Google password. Gmail's server is telling you that 2-Step Verification is on and it wants an app password. Create one and use it.

"Invalid credentials" or "password incorrect"

Check that the username is the whole address, including @gmail.com or your own domain. Paste the app password again without a trailing space. If you changed your Google password recently, the old app password was revoked: make a new one.

Mail arrives but will not send

The outgoing server is set up separately in most apps. Check that it is smtp.gmail.com, that the port and security type match one of the pairs in the table, and that it uses the same app password.

How Mailvie signs in to Gmail

Mailvie version 0.1.0 signs in to Gmail with an app password. It does not have the "Sign in with Google" window yet. On the Add an account screen you pick Gmail, then fill in three fields: your email address, the app password, and a name for the sidebar. The servers are filled in for you, spaces in the password are fine, and a button on the screen opens Google's app password page.

The password is saved in the macOS Keychain on your Mac and is sent only to Google's mail servers. Mailvie has no account of its own and no server that your mail passes through: the list of every connection Mailvie makes is published. Reading and searching your mail are free. Sending needs a plan, and the monthly and yearly plans start with a 7-day trial: see Mailvie's plans and prices.

Mailvie runs on Apple Silicon Macs with macOS 14 or later. You can download Mailvie for Mac and add Gmail in a few minutes once the app password is ready.

Questions people ask

Is a Gmail app password safe to use?

It is as safe as the app you type it into. It gives that app access to your account without the second step, so use it only in an app you trust. You can delete it from your Google Account at any time, which signs that app out without changing your main password.

Do I need a new app password for each mail app?

You do not have to, but it is the better habit. With one per app or device, you can remove the password for a Mac you sold or an app you stopped using and leave the others working.

Why can I not find app passwords in my Google Account?

Google says the option is missing when 2-Step Verification is off, when it is set up with security keys only, when a work or school administrator has disabled it, or when the account has Advanced Protection.

Does the app password stop working if I change my Google password?

Yes. Google says it revokes your app passwords when you change your Google Account password. Create a new one afterwards and enter it in each mail app that used the old one.

Share this guide

XLinkedInEmail

Written by Sanjeev Maharjan

Sanjeev Maharjan builds Mailvie, a mail app for the Mac. Found a mistake in this guide? Write to [email protected].

Keep reading

More guides

Get Mailvie

Read your mail in Mailvie today

Reading and search are free. Sending, AI and the clean-up tools open with a 7-day trial. Needs macOS 14 or later on Apple Silicon.