chmod/chown on mac not working
My java command is not working, and I think it is related to permission. I have tried chmod/chown to change the permission but it does not have any affect. Wh开发者_如何学编程en I start the java application with sudo it works. Any idea?
iMac:~/ java -version
java(347) malloc: *** error for object 0x10009357c: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap
iMac:~/ sudo java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
iMac:~/ which java
/usr/bin/java
iMac:~/ sudo chmod 777 /usr/bin/java
iMac:~/ sudo ls -l /usr/bin/java
lrwxrwx--- 1 root wheel 74 Mar 11 10:26 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
iMac:~/
In fact, I notice now that the flash player stopped working as well. What can be wrong? I only restarted computer installed itunes update with Apple Software Update.
Whilst not entirely relevant to the questioner's text but a related answer to actual question title - as in chmod not working on Mac OSX.
With certain files you may run into: [sudo] chmod: Operation Not Permitted. This indicates another problem which is down to the OSX/BSD flags system functionality. Any file can have these flags set using the chflags tool, and viewed using ls -lO
yourfile (on osx) ls -lo
yourfile (on BSD). The one that causes this particular error is the 'immutable' flag. Which can be unset using (prefixing it with sudo as necessary):
chflags nouchg yourfile
When you run "ls -l /usr/bin/java" you are only viewing the permissions of the link.
If you want to see the "real" permissions, add L to the options, i.e. "ls -lL /usr/bin/java".
Same thing when you run chmod, then you change the permissions of the real file. If you want to change permissions of the link, add -h to chmod.
Good luck!
Use Disk Utility to repair permissions.
精彩评论