7

While trying to build the NumPy Python math module with Intel's Math Kernel Library (MKL) on OSX 10.8.3, I was running into some problems with the Accelerate and vecLib frameworks overriding the MKL. At any rate, I decided it would be a good idea to rename /System/Library/Frameworks/Accelerate.framework and /System/Library/Frameworks/vecLib.framework temporarily. Nothing happened (at least, on the command line) after moving Accelerate.framework. However, after entering

sudo mv vecLib.framework/ vecLib.framework.old

I got the following error:

sudo: unable to initialize PAM: No such file or directory

Oops. Unfortunately, the mv command worked, but now when I try to use sudo I get the same error, but the commands don't work. When I tried to rename vecLib through Finder, I get:

The operation can’t be completed.
An unexpected error occurred (error code -8076).

which apparently is some sort of permissions error.

So, my question is how can I get sudo working again? App Store.app won't even run, so I can't reinstall XCode (which is apparently where vecLib.framework comes from) or anything else. I'm afraid to reboot because I'm worried the computer will hang, whereas (as you can tell) at least it's working for now, albeit without any elevated permissions capabilities.

Any suggestions?


Normally I wouldn't cross-post, but I need to figure out a way to fix this ASAP.

2
  • Please: where is it indicated that -8076 relates to permissions? For me today, error -8076 occurred when attempting to rename a file or folder that was already renamed – when Finder had not yet shown the result of the first successful attempt to rename. Jan 18, 2014 at 9:12
  • I ran into the same problem when I attempted to replace /usr/lib/libsqlite3.dylib with my own copy. Apparently, this sqlite3 library is also used by other system program(s) and OS/X is not happy about not finding it. The solution from @MattDMo works great and allows me to restore the original sqlite3 library Feb 19, 2016 at 2:10

4 Answers 4

8

You can also reveal the /etc/pam.d/sudo file in the Finder and change the permissions there.

open /etc/pam.d/

Permission change

Make sure to reset the permissions afterwards again.

1
  • 1
    This actually worked! But the first time I attempted it, it didn't because I missed an important step until I saw your screenshot again in an identical answer: unix.stackexchange.com/a/636980. Apparently, I was supposed to click on the padlock at the bottom right of the permissions screen (which was locked), but it was not visible in the view port, so I had to scroll down to see it then click to unlock it.
    – Saheed
    Aug 27, 2022 at 8:34
4

With OSX you can boot into single-user mode by holding down Command-S after rebooting. You essentially have password-less root access to the system, with no PAM or other authentication, so you can fix all sorts of system issues like lost passwords and accidental directory renames this way.

Yes, this is a potential security hole, but giving someone physical access to your machine is a security hole itself. It can be disable/password-protected if you want, and if you're really worried you can always encrypt your volumes so an intruder couldn't read your files even if they got this far.

2
  • You saved me today. I saved /etc/pam.d/sudo with a typo, and I couldn't fix the typo afterwards. Note that the process for single-user mode has changed.
    – Michael
    Aug 10, 2020 at 16:37
  • 1
    I did exactly that you told, but I am not able to access the /etc/pam.d/ folder.... Although it is listing. it says folder does exist.... Should we mount anything?
    – Prakash P
    Nov 24, 2020 at 5:44
1

You can enable the root user via System Preferences. No need to log out or boot into single user mode. See: Typo in /etc/pam.d/sudo and cannot recover from it

2
  • It looks like the Apple Support article you're obliquely referring to was published in 2017. I'm fairly sure this capability wasn't available in OS X back when I originally had the problem in 2013, but it looks like it could be a reasonable solution now.
    – MattDMo
    Jan 17, 2021 at 20:01
  • Yes, thanks for clarifying! I was posting this to the top google result after research, so others in my situation can benefit from the linked approach.
    – seidtgeist
    Jan 18, 2021 at 15:58
1

Another alternative is to enable Root user ( https://support.apple.com/en-us/HT204012 ) and login with it. Then you will be able to edit the file from finder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.