0

I recently wanted to use pod to update the path of a framework.

Cocoapods is installed and can be find here :

/usr/local/bin/

But surprise! It is set to root only access :

ls -l /usr/local
drwx------   504    wheel  bin/
drwxr-xr-x@  john   staff  include/
drwxr-xr-x@  john   staff  lib/
drwxr-xr-x   root   wheel  share/

So I can't use pod because in any case :

  • pod install realm

    heeeyy dude, you can't access pod cause you are not root .!.

  • sudo pod install realm

    heeeyy dude, you can’t use pod as a root! .!.

I feel that this folder shouldn't be set as 'root only' because:

I know Linux isn't a BSD but still, it doesn't look that much different no o.O


Finally here are my questions:

  • I searched and there is no user with the uid 504, is this suspicious?

(I checked it with ""dscacheutil -q user | grep 504"")

  • What are suposed to be the rights and owner on the folder?

  • Is there someone who had the same problem?

  • Any idea about why this happened?

2
  • 1
    Did you ever use MacPorts or something similar? The reason I ask is on my system, uid 504 is polkituser which is apparently sometimes created by MacPorts, so it's possible it was a user that has since been removed.
    – tubedogg
    Oct 27, 2016 at 23:25
  • I think I used it once yes, so it might be this I guess. Thank you~
    – itMaxence
    Oct 27, 2016 at 23:28

3 Answers 3

1

The default setup for /usr/local is shown here

~ $ ls -ld /usr/local
drwxr-xr-x@ 3 root  wheel  102  5 Aug 20:01 /usr/local 

this means that files and directorries under /usr/local can only be created by the root user e.g. my /usr/local has

~ $ ls -l /usr/local
total 0
drwxr-xr-x  12 root  wheel  408 11 Sep 12:11 bin

So your share directory looks normal but the others have odd changes

include and lib look like you changed the permissions of /usr/local so you could write to it and then created these two directories (The most common setup like that is installing Homebrew) (we need to see what ls -ld /usr/local shows.

As for bin there must have been several things. First a new user must have been added at some time, normal users (created through the System Preferences GUI start at 501) e.g. I am the second user and so my id is 502 and then the directory was created or chowned to that user- or the directory was created elsewhere and then moved as root to where it is.
Separately the permissions of the directory have been changed by chmod 700

So the correct setting is as per /usr/local/share unless you are using Homebrew in its default install and then they should be like /usr/local/include

1
  • I found an old wireshark file in /usr/local/bin that was owned by the uid 504! (since removed) I have only RubyGems and Macports installed, no Homebrew ls -ld /usr/local shows drwxr-xr-x root wheel /usr/local/ Thank you!
    – itMaxence
    Oct 28, 2016 at 0:19
1

The /usr folder is protected by System Integrity Protection (SIP) and owned by root, as are all of its contents, with the sole exception of /usr/local (and its subdirectories).

The root user is uid 0, not 504. The 500-series should be user- or app-created accounts. /usr/local/bin on my system is owned by my username "tubedogg" in group "admin", and has drwxrwxr-x as the permissions.

1
  • Thanks for the answer! I'll update these rights \o/ Yes I know that the root ID is 0 but the rights on the folder are drwx------ so only root could access it, that's what I meant. I didn't know for the 500+ IDs, thank you
    – itMaxence
    Oct 27, 2016 at 23:31
-1

The /usr/local/ itself is owned by root wheel for me. But all folders that you might use as pods user bin include etc lib opt share var are owned by my user and admin group.

To change the ownership of a folder and files in it run: sudo chown -R john:staff /usr/local/bin chmod -R 755 /usr/local/bin

1
  • Thanks for the answer! Can't upvote the answers tho o/ (not enough reputation)
    – itMaxence
    Oct 27, 2016 at 23:47

You must log in to answer this question.

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