Mount Google bucket to Mac
***2024 update: there is now an easier GCP-supported setup as pointed out by Simone Di Cola in the comments***
>>>original 2021 post>>>
While it is not officially supported, I was able to mount a Google bucket to my Mac using gcsfuse. First I followed gsutil installation instructions from the article "Moving data between local storage and workspace bucket" (I am working remotely and had to disconnect from the Broad VPN for the gcloud init step). After I got gsutil to work locally, I set out to mount a bucket. Unfortunately, the brew installation of gcsfuse was discontinued in July 2021, so I followed the steps from the "Building from source" section here:
1. Install dependency Go using these instructions
2. Install dependency osxfuse using "brew install --cask osxfuse". I had to go to System Preferences/Security & Privacy/ and "Allow", and needed to run "brew reinstall --cask osxfuse". In the end, the System Preferences had new icons for FUSE and macFUSE at the bottom.
3. I already had git installed.
4. Install gcsfuse using as follows:
GO111MODULE=auto go get -u github.com/googlecloudplatform/gcsfuse
5. Add "export PATH="$PATH:$HOME/go/bin" to ~/.zshrc (my local terminal runs zsh). Open a new terminal window.
Now I can mount a bucket as follows:
mkdir ~/gcsfuse
export GOOGLE_APPLICATION_CREDENTIALS="/Users/username/.config/gcloud/legacy_credentials/user@broadinstitute.org/adc.json"
gcsfuse --implicit-dirs <BUCKET> ~/gcsfuse
open ~/gcsfuse
# Unmount
umount ~/gcsfuse
I hope this helps someone.
Comments
3 comments
Thank you for detailing this so clearly, Peter! This will be very helpful for Terra users.
If you landed on this page in 2024, follow these 3 steps, with the precondition that you got brew installed in your machine:
Once you have done that, you should have the gcsfuse binary inside the directory ~/go/bin.
You can now follow the official documentation https://cloud.google.com/storage/docs/gcsfuse-mount#mount-bucket and mount your bucket. A restart will be necessary to enable the extension, but once you follow the instructions on the screen you are good to go.
Hope this helps
Simone
Peter van Galen feel free to use the above steps to update your blogpost.
This was such a lifesaver! I was really stuck trying to figure out why my Go program kept acting unpredictably during concurrent operations. The explanation about data races and the use of channels for synchronization cleared things up completely.
Also, learning how to use the `-race` flag for debugging was a game-changer—it helped me catch and fix race conditions I didn’t even realize existed. I appreciate how thorough and practical this guide is!
For anyone setting up their Go environment on Debian, the steps from
install go on debian were super helpful to get started smoothly. Thank you for this great resource!
Please sign in to leave a comment.