2

Looking for some guidance on how to fix my permissions on my /usr/bin directory. I actually recently had a data recovery on my machine where I had to have my whole home directory copied to a new mac.

Upon this I noticed that my old binaries I had in my /usr/local folder prior to my migrating my data are no longer able to be ran.

I also do not have brew, and I am unable to install it.

Attempting to chown /usr/local also fails

% sudo chown -R "$USER":admin /usr/local
chown: /usr/local: Operation not permitted

This first started happening when I noticed brew is not installed. When I try to install brew, I get the following:

% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password).
Password:
==> 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
==> The following new directories will be created:
/usr/local/bin
/usr/local/sbin

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/bin /usr/local/sbin
mkdir: /usr/local/bin: Not a directory
mkdir: /usr/local/sbin: Not a directory
Failed during: /usr/bin/sudo /bin/mkdir -p /usr/local/bin /usr/local/sbin

Here is my ls -aleO@ /usr/local

total 52960
drwxr-xr-x  14 root             wheel  sunlnk                 448 Feb 24 19:19 .
drwxr-xr-x@ 11 root             wheel  restricted,hidden      352 Feb 18 16:51 ..
    com.apple.rootless         0 
drwxr-xr-x   2 myuser.user  admin  -                       64 Feb 24 19:19 Caskroom
drwxr-xr-x   2 myuser.user  admin  -                       64 Feb 24 19:19 Cellar
drwxrwxr-x   2 myuser.user  admin  -                       64 Feb 24 19:19 Frameworks
-rwxrwxr-x@  1 myuser.user  admin  -                 12434524 Feb 23 21:11 bin
    com.apple.quarantine          57 
drwxrwxr-x   2 myuser.user  admin  -                       64 Feb 24 19:19 etc
drwxr-xr-x  20 myuser.user  admin  -                      640 Feb 16 11:12 go
drwxrwxr-x   2 myuser.user  admin  -                       64 Feb 24 19:19 include
drwxrwxr-x   2 myuser.user  admin  -                       64 Feb 24 19:19 lib
drwxrwxr-x   2 myuser.user  admin  -                       64 Feb 24 19:19 opt
-rwxrwxr-x@  1 myuser.user  admin  -                 14033312 Feb 23 21:44 sbin
    com.apple.quarantine          57 
drwxrwxr-x   3 myuser.user  admin  -                       96 Feb 24 19:19 share
drwxrwxr-x   3 myuser.user  admin  -                       96 Feb 24 19:19 var```
4
  • You've tagged this nix, but it feels like Mac. You cannot chown folders on the boot drive if you're on Catalina or Big Sur.
    – Tetsujin
    Commented Feb 25, 2021 at 16:28
  • I understand this, the problem is, I cannot install anything using brew. I cannot put any executables in my /usr/bin path to run them from any directory because I do not have the rights to. Brew also cannot be installed due to this issue as well.
    – Wraiith
    Commented Feb 25, 2021 at 16:55
  • You have no rights to any folder on the boot partition if you are on Catalina or Big Sur… which you have yet to clarify.
    – Tetsujin
    Commented Feb 25, 2021 at 16:56
  • Correct, but yes I am on Catalina. But prior to me migrating my data, (same OS) I had brew installed, and I had the ability to run executables from this path.
    – Wraiith
    Commented Feb 25, 2021 at 17:01

1 Answer 1

1

I needed to remove /usr/local/bin and /usr/local/sbin. After doing so I was able to install homebrew. It looks like I had existing symlinks to this directory.

1
  • If this works for you, you should accept it as the answer.
    – Pe Dro
    Commented Nov 15, 2021 at 14:02

You must log in to answer this question.

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