chmod/chown 在 Mac 上不起作用

发布于 2024-10-21 10:29:11 字数 825 浏览 2 评论 0原文

我的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

栖迟 2024-10-28 10:29:11

虽然与提问者的文本不完全相关,但与实际问题标题相关的答案 - 例如 chmod 不适用于 Mac OSX。

对于某些文件,您可能会遇到:[sudo] chmod:不允许操作。这表明另一个问题是由 OSX/BSD flags 系统功能引起的。任何文件都可以使用chflags工具设置这些标志,并使用ls -lO yourfile(在osx上)ls -lo yourfile(在BSD)。导致这一特定错误的原因是“不可变”标志。可以使用以下命令取消设置(根据需要在其前面加上 sudo 前缀):

chflags nouchg yourfile

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
[浮城] 2024-10-28 10:29:11

当您运行“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!

东走西顾 2024-10-28 10:29:11

使用磁盘工具修复权限。

Use Disk Utility to repair permissions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文