Fix “Permission denied @ rb_file_s_symlink” error of installing homebrew

Today I tried to install homebrew on my macOS Mojave, and came across following errors:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
......
Already up-to-date.
Error: Failed to link all completions, docs and manpages:
  Permission denied @ rb_file_s_symlink - (../../../Homebrew/completions/zsh/_brew, /usr/local/share/zsh/site-functions/_brew)
Failed during: /usr/local/bin/brew update --force

After refering stackoverflow, I fixed it through following command:

$ sudo chown -R $(whoami) $(brew --prefix)/*

14 thoughts on “Fix “Permission denied @ rb_file_s_symlink” error of installing homebrew”

  1. “`
    sudo chown -R $(whoami) […]
    “`

    This has always bothered me (*not* just the `whoami` part BTW – https://github.com/Homebrew/brew/pull/5340/) – we’re going back from a fully-fledged multi-user UNIX system, to a single-user one. Anyone heard of groups? It’s fine for a single-user laptop but doesn’t work for a multi-user Mac.

    How about make Homebrew multi-user-aware, and use this instead?

    “`
    sudo chgrp -R admin $(brew –prefix)/*
    “`

    1. “`
      sudo chgrp -R admin $(brew –prefix)/*
      “`
      doesn’t work as expected – casks can’t be moved to the applications folder after running that command.

    2. Hey guys, I’m a complete noob and just ran this (exactly) in terminal…

      sudo chgrp -R admin $(brew –prefix)/*

      I entered password, it returned “Error: Unknown command: –prefix”
      then started to change permissions on stuff… Pop-ups asking for permissions on certain folders/apps, I denied while getting very anxious. Didn’t know how to stop it so I restarted the computer. I now wonder… WHAT have I done, is it serious? And how to fix it?

      Any kind of damage estimation would be very appreciated.
      Thanks

  2. Thank you, this post saved me from a headache. Why is this not already part of the Homebrew installation script instead of having to type it?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.