在 macOS 上,“chmod --reference=<参考文件> <文件>”返回“chmod:非法选项 -- -”

Con*_*nor 6 chmod macos

我正在学习如何更改文件的权限。在我的 macOS 系统上,我想使用该命令将权限从一个文件复制到另一个文件chmod --reference=reference-file file,但它不断返回

chmod: illegal option -- -
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激。

Kus*_*nda 5

macOSchmod上的 不是 GNU chmod(通常在 Linux 系统上找到),因此不支持特殊的非标准 GNU“长选项”。

chmod在 macOS 上,您仍然可以通过 Homebrew 包管理器访问 GNU 。gchmod一旦您安装了coreutils软件包,该实用程序就可用

brew install coreutils
Run Code Online (Sandbox Code Playgroud)