chmod/chown 在 Mac 上不起作用
我的java命令不起作用,我认为这与权限有关。我尝试过 chmod/chown 来更改权限,但没有任何影响。当我使用 sudo 启动 java 应用程序时,它就可以工作。有什么想法吗?
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:~/
事实上,我现在注意到 Flash 播放器也停止工作了。有什么问题吗?我只重新启动了安装有 Apple Software Update 的 iTunes 更新的计算机。
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. When 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
虽然与提问者的文本不完全相关,但与实际问题标题相关的答案 - 例如 chmod 不适用于 Mac OSX。
对于某些文件,您可能会遇到:[sudo] chmod:不允许操作。这表明另一个问题是由 OSX/BSD flags 系统功能引起的。任何文件都可以使用chflags工具设置这些标志,并使用
ls -lO
yourfile(在osx上)ls -lo
yourfile(在BSD)。导致这一特定错误的原因是“不可变”标志。可以使用以下命令取消设置(根据需要在其前面加上 sudo 前缀):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):当您运行“ls -l /usr/bin/java”时,您仅查看链接的权限。
如果你想查看“真实”权限,请在选项中添加L,即“ls -lL /usr/bin/java”。
当您运行 chmod 时也是如此,然后您更改实际文件的权限。如果要更改链接的权限,请在 chmod 中添加 -h。
祝你好运!
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.