I recently got issued a Macbook Air M1, 2020 running macOS Big Sur 11.2.3. I rely on Google Drive file stream for my work and I have so far managed to successfully install the program. However, it seems I am having problems indexing the drive with Spotlight. Spotlight does not automatically index the drive, and I need to run: sudo mdutil -i on /Volumes/GoogleDrive/ every time I boot the machine up. It takes a while to index the 80 gigabyte drive and then it works as I like it. The only problem is that when I restart the machine it appears the index is gone and when I run sudo mdutil -s /Volumes/GoogleDrive/ it indicates that indexing is disabled. I'm hoping there's a workaround where the index will stick around so I don't have to enable it and wait everytime I boot the machine up.

There are separate instructions for installing GDFS on an M1 Mac, but since my install worked pretty seamlessly I didn't boot into recovery mode or anything like it suggests in there. I'm wondering if allowing user management of kernel extensions will help this problem, as I'd rather not tamper too much with this work computer.

5 Answers 5


Here's a step by step workaround for Google Drive v49 (might not work in future versions):

  1. Quit Google Drive (click on the Google Drive icon in the menu bar, then click on the cogwheel, then click Quit).
  2. Save this file somewhere as change_gdrive_smb_port.py (ex: curl -LO https://gist.githubusercontent.com/emersonford/85cc74f7f90c81d1b75c3c246124591d/raw/442834222e2aaa2be61badb6e84f53183ee10624/change_gdrive_smb_port.py).
  3. Read over the script yourself so you know it's safe to run.
  4. Run this script with python3 change_gdrive_smb_port.py. It will give you some prompts when it has found an account and to what port to change that account's SMB port to. These ports should be unused ports on your system.
  5. Relaunch Google Drive.
  6. Run the mdutil -i on command the script spits out.
  7. Give Spotlight some time to index everything in Google Drive. It should now stay enabled!

If my script happens to break Google Drive or if you want to reset this change, all you need to do is remove core_feature_config from ~/Library/Application Support/Google/DriveFS/<ACCOUNT_NUM> and restart Google Drive.

EDIT: This isn't as permanent as I thought. It looks like Google can remotely push changes to the "feature_config" file, which they've been doing once a day by the looks of it. When they push out changes, it ends up overwriting the changes my script made to core_feature_config...

At a minimum, you can always rerun the script and restart Google Drive (chain it together with pkill "Google Drive" && sleep 5 && echo "yes\n[PORT_NUM]" | python3 change_gdrive_smb_port.py && open /Applications/Google\ Drive.app). It's not great, but it preserves the Spotlight index database so you don't have to wait / waste CPU cycles on reindexing everytime.

I'll update this again if I find a workaround!

Technical explanation

Google Drive used to use a custom FUSE implementation called DriveFS on macOS which appears to have had Spotlight indexing support built in. It appears -- and this is all speculation on my part as I'm not a Google employee -- they had a lot of trouble bringing this over to the new M1 Macs based on this article. Even without that, FUSE implementations tend to be really hairy to maintain, so I wouldn't blame them for wanting to move off of it.

I assume that as part of their Google Drive streaming for everyone roll-out, they wanted to ensure everyone could run Google Drive without mucking with kernel extensions, so they appear to have migrated the Google Drive filesystem to a Samba server implementation, then mount that with macOS's built in Samba client (hence why you now see 'localhost' mounted in Network). Kind of clever if you ask me!

Now, the problem with this for Spotlight is two-fold. First, Apple now defaults to disabling Spotlight on network drives (likely with good reason), thus you now have to manually enable Spotlight on Google Drive.

Second, Google Drive sets the Samba server's port binding to -1, which means the OS picks a random available port for you. I'm not sure when this changed, but Spotlight no longer places its index in the root folder with the name Spotlight-V100. All Spotlight indexes are now stored in /var/db/Spotlight-V100; further, for network drives, that index is named something like smb%3A%2F%2FDRIVE@localhost%3A59999%2FGoogle%2520Drive. If you look closely, the port number of the network drive is part of the Spotlight index name. This is why Spotlight indexing seems to disable itself after some time. When Google Drive remounts the FS (sometimes randomly, sometimes on network disconnects), it's likely it got a new port from the OS to bind to. So to Spotlight, this looks like an entirely different network drive you haven't enabled Spotlight indexing on, thus you have to not only reenable indexing, but also wait for Spotlight to index everything all over again.

I dug around the logs (in ~/Library/Application Support/Google/DriveFS/Logs) and noticed this in the start up section:

2021-07-22T18:12:33.759ZI [6139763:CrBrowserMain] global_features_manager.cc:266:CompositeAll Composited global features *WITHOUT* overrides: drive_dot: true
mac_smb_port: -1

so it seems changing the SMB port to a static port is a preference, just got to figure out where. It took me a little bit to find this as it doesn't appear to be a plist setting, but using strings, I was able to deduce it was in core_feature_config which I discovered to be a binary file in the protobuf format. So just had to find the right field and replace the mac_smb_port value with what I wanted (with the right protobuf encoding). Once I figured that out with the right script, Spotlight has been stable for me since!

Don't anticipate this will be an issue for much longer though, so if you aren't comfortable using my script and are willing to wait, I think you can sit tight. Either the Google Drive folks will add a static port number (or setting) to fix this issue or they'll migrate to using the built-in File Provider API (which I discovered you can enable right now by changing a different flag in core_feature_config), which will likely have better Spotlight support built in.

  • when running it says unable to find mac_smb_port field! . i'm not in M1, i've the same problem on intel mac, every time i restard mdutils is disabled
    – EsseTi
    Jul 23, 2021 at 16:17
  • 1
    @EsseTi could you rerun the commands again with the updated instructions I provided? Jul 25, 2021 at 1:41
  • I was albe to make the script running, however at restart the indexing is yet disabled again. re-running the script tells me that the port was reset to -1. as if they deleted what the script does
    – EsseTi
    Jul 27, 2021 at 13:20
  • 1
    @EsseTi sorry for the delay, I looked into this and think I figured out the issue. Not sure how to circumvent it at the moment, but if I figure something out I'll update my comment. It looks like Google can remotely push changes to the "feature_config" file, which they've been doing once a day by the looks of it. When they push out changes, it ends up overwriting the changes my script made to core_feature_config... At a minimum, you can always rerun the script and restart Google Drive. It's not great, but it preserves the Spotlight index database so you don't have to reindex. Aug 5, 2021 at 0:30
  • Any workig workaround? beacuse this is not really working. It reindex and takes me forever to have it back. can i place a script in the startup or smt like that?
    – EsseTi
    Aug 31, 2021 at 7:11

I hope this helps someone. Google Drive v59 has this option: "Spotlight integration When this is enabled, search text you enter in Spotlight will be sent to Google in order to find matching Drive files Enable Spotlight to search streaming files"

I had to check this under Preferences (gear), Settings (gear) per account.

enter image description here

  • 1
    Glad to see that it's finally built-in! Thanks for sharing the update, I wouldn't have noticed since it's not enabled by default.
    – divieira
    Jul 11, 2022 at 12:59
  • Seems like this was removed again? :( :( So sad! Checked with v67 and this setting is not there. Anyone can confirm?
    – kLy
    Nov 25, 2022 at 0:05

This was driving me insane as well, and I was prepared to try setting up a cron to run the workaround python script from @emersonford (which looks great and thank you btw), but I think I may have found a better solution for my needs.

I noticed in GoogleDrive preferences under Google Drive > My Drive syncing options if you change from Stream to Mirror, and then choose a local folder (I did ~/gd), spotlight appears to index all the files!

Change from Streaming to Mirror

I just now turned this on and it appears to work so far, fingers crossed it continues.

  • Obviously if you switch to mirror, the file are stored locally and Spotlight works. The original question is to make it work with stream mode.
    – steco
    Nov 12, 2021 at 16:49
  • Ah, ya, I didn't even see "Stream" in the title of this post. I ended up here after googling the spotlight problem and Stream was not a requirement for me, so figure maybe it may be useful to some others as well, but, true, my solve is not for you if you want Stream and not Mirror.
    – kortina
    Nov 13, 2021 at 17:52
  • Yeah, very different solution. Glad it works for you though.
    – Wes Modes
    Dec 25, 2021 at 17:11

I know that most of you are interested in solving the problem when streaming Google Drive's content ("Stream Files" option on in 'Settings', see @kortina's screenshot).

But for those of you (like me) who ended up reading this post because Spotlight won't index your Drive folder despite using the "Mirror Files" option, the solution is simple: follow these directions and reboot.

Edit: here's the instructions:

Go to System Preferences/ Spotlight. Click the Privacy tab. Drag the Google Drive folder to the list of locations that Spotlight is prevented from searching. Wait a moment and then click the remove button (–) to remove it from the list. Quit System Preferences. Spotlight will now start indexing the folder, which you can verify looking at the active processes in Activity Monitor. When it's done, give your Mac a nice reboot.

Worked for me, will work for you!

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – agarza
    Nov 12, 2021 at 18:17
  • 1
    This used to work, but it doesn't work with Big Sur or newer versions of OSX.
    – iopener
    Dec 8, 2021 at 16:23

For Alfred App users (like me: recommended!) there is an easy workaround: https://www.alfredapp.com/blog/guides-and-tutorials/google-drive-workflow/ - I am still trying to make it work, but apparently others have no problem setting it up and making it to work.

  • my fault, I added an account to Google Drive and the folders I used as scope for Alfred were not the right ones anymore. I updated Search Scope within Alfred and now everything works again, without the abovementioned workflow. I keep it as answer because maybe others find it useful. Feb 1, 2022 at 16:18
  • The workflow above is not working on my machine because I still use my Mid-2010 MBP (to my complete satisfaction) and apparently it is too old. Feb 2, 2022 at 15:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .