MacOS – OS X Yosemite Hard Disk Errors even after Repairing them

disk-utilityhard drivemacospermission

Basically, I do a lot of C programming (for class) so I use gcc a lot on my mac. Recently since two days, whenever I ran it, the entire computer is getting frozen, and a force restart is necessary to get it working again.

So I suspected what might be the error, so I ran disk-utility and checked Yosemite partition for errors. Apparently there are a lot of errors, so I booted into single user mode, and ran the following commands.

$ fsck -fy
$ fsck -fy
$ reboot

Upon reboot, my disk is now repaired, but the computer still froze when I ran gcc So this time, I ran a permissions verification in the disk utility. It said the following.

Verifying permissions for “Yosemite”
Open error 22: “Invalid argument” on usr/bin/gatherheaderdoc
Open error 22: “Invalid argument” on usr/bin/gcc
Open error 22: “Invalid argument” on usr/bin/gcov
Open error 22: “Invalid argument” on usr/bin/git

I tried to repair the permissions, but these persist. I even tried repairing the permissions multiple times, even from RecoveryHD and also from single user mode, but these errors persist.

What do these mean? What should I do to fix it?

Edit:

Here's the output of ls -l usr/bin/gcc

Harshas-Mac-Pro:~ sriharshachilakapati$ ls -l /usr/bin/gcc
-rwxr-xr-x  1 root  wheel  14160 Sep 27 07:36 /usr/bin/gcc
Harshas-Mac-Pro:~ sriharshachilakapati$ 

Edit:

My partition is again damaged. This is the output after I just repaired it from single-user mode.

Verifying volume “Yosemite”
Verifying file system.
Using live mode.
Checking Journaled HFS Plus volume.
Checking extents overflow file.
Checking catalog file.
Checking catalog hierarchy.
(It should be 337485 instead of 337484)
Volume bitmap needs minor repair for under-allocation
Checking volume information.
The volume Yosemite was found corrupt and needs to be repaired.
The volume Yosemite was found corrupt and needs to be repaired.
The volume Yosemite was found corrupt and needs to be repaired.
The volume Yosemite was found corrupt and needs to be repaired.
The volume Yosemite was found corrupt and needs to be repaired.
The volume Yosemite was found corrupt and needs to be repaired.
The volume Yosemite was found corrupt and needs to be repaired.
The volume Yosemite was found corrupt and needs to be repaired.
The volume Yosemite was found corrupt and needs to be repaired.
The volume Yosemite was found corrupt and needs to be repaired.
File system check exit code is 8.
Error: This disk needs to be repaired using the Recovery HD. Restart your computer, holding down the Command key and the R key until you see the Apple logo. When the OS X Utilities window appears, choose Disk Utility.

This occurred just after I had repaired my partition from single user mode. Why?

Best Answer

error 22 is the EINVAL in libc error codes. Maybe your glibc is corrupted? I think you can reinstall it from Xcode based on this question https://stackoverflow.com/questions/9353444/how-to-use-install-gcc-on-mac-os-x-10-8-xcode-4-4