Catalina 10.15.4 homebrew permission problem

hello,
I dont know how I managed this but today I noticed that my Homebrew is smashed.

When I run the brew command I have this output:

Traceback (most recent call last):
13: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in <main>' 12: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in require_relative’
11: from /usr/local/Homebrew/Library/Homebrew/global.rb:36:in <top (required)>' 10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require’
9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' 8: from /usr/local/Homebrew/Library/Homebrew/config.rb:56:in <top (required)>’
7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/pathname.rb:578:in mkpath' 6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:200:in mkdir_p’
5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:200:in each' 4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:215:in block in mkdir_p’
3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:215:in reverse_each' 2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:217:in block (2 levels) in mkdir_p’
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239:in fu_mkdir' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239:in mkdir’: Permission denied @ dir_s_mkdir - /private/tmp (Errno::EACCES)

so I did some research and ended up here:
https://gist.github.com/irazasyed/7732946

But nothing changed.
Even when I try to uninstall to do a fresh installation with:
master/uninstall.sh

this comes out:

mkdir: /tmp/uninstall.64859: Not a directory
Unable to create temp dir ‘/tmp/uninstall.64859’

When I try to install it over it this happens:

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew…
HEAD ist jetzt bei 9fcaa46cd Merge pull request #7567 from zachauten/cask-help-exception
Traceback (most recent call last):
13: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in ’ 12: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in require_relative’
11: from /usr/local/Homebrew/Library/Homebrew/global.rb:36:in <top (required)>’ 10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require’
9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require’ 8: from /usr/local/Homebrew/Library/Homebrew/config.rb:56:in <top (required)>’
7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/pathname.rb:578:in mkpath’ 6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:200:in mkdir_p’
5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:200:in each’ 4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:215:in block in mkdir_p’
3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:215:in reverse_each’ 2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:217:in block (2 levels) in mkdir_p’
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239:in fu_mkdir’ /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239:in mkdir’: Permission denied @ dir_s_mkdir - /private/tmp (Errno::EACCES)
Failed during: /usr/local/bin/brew update --force
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:

==> Next steps:

Run brew help to get started
Further documentation:

When I run brew doctor same thing:

Traceback (most recent call last):
13: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in <main>' 12: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in require_relative’
11: from /usr/local/Homebrew/Library/Homebrew/global.rb:36:in <top (required)>' 10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require’
9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' 8: from /usr/local/Homebrew/Library/Homebrew/config.rb:56:in <top (required)>’
7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/pathname.rb:578:in mkpath' 6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:200:in mkdir_p’
5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:200:in each' 4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:215:in block in mkdir_p’
3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:215:in reverse_each' 2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:217:in block (2 levels) in mkdir_p’
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239:in fu_mkdir' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239:in mkdir’: Permission denied @ dir_s_mkdir - /private/tmp (Errno::EACCES)

Any ideas?

You used a tool that cleans up your mac, enabled dangerous features and now it removed a system directory.

  1. Make sure a directory /private/tmp exists
  2. Make sure the access and owner are drwxrwxrwt root:wheel
  3. Make sure there is a symlink from /tmp to /private/tmp

thank you so much! saved my day! and true; used

before!
used afterwards


to fix everything