Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS Catalina 10.15.4 permission problem #203

Open
luke0zong opened this issue May 13, 2020 · 0 comments
Open

macOS Catalina 10.15.4 permission problem #203

luke0zong opened this issue May 13, 2020 · 0 comments

Comments

@luke0zong
Copy link

After sudo make install the latest release10.1.0 on Catalina, there are permission issues when running clang -lcs50 code.c without sudo:

$ clang --version
Apple clang version 11.0.3 (clang-1103.0.32.59)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ clang -lcs50 code.c 
ld: can't open file, errno=13 file '/usr/local/lib/libcs50.dylib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

When checking the lib file permissions, it seems like the install script will set those library files under root user thus if compile with a normal user will cause the above error.

-rwx------    1 root    staff   17864 May 12 20:19 libcs50-10.1.0.dylib
-rw-------    1 root    staff    9000 May 12 20:19 libcs50.a
lrwx------    1 root    staff      20 May 12 20:19 libcs50.dylib -> libcs50-10.1.0.dylib

Changing the permissions on those files by doing the following might solve the issue:

$ cd /usr/local/lib
$ sudo chmod g+rwx libcs50-10.1.0.dylib

(you might also need to run $ ln -sf libcs50-10.1.0.dylib /usr/local/lib/libcs50.dylib to change the owner to your user for the link.)

After the change, the permissions on those files should look like something like this:

-rwxrwx---    1 root    staff   17864 May 12 20:19 libcs50-10.1.0.dylib
-rw-------    1 root    staff    9000 May 12 20:19 libcs50.a
lrwx------    1 (user)  staff      20 May 12 21:09 libcs50.dylib -> libcs50-10.1.0.dylib

Now compile without sudo will work as expected.

Please address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant