博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Recusively change the owner of files (chown) on Mac OS X
阅读量:6211 次
发布时间:2019-06-21

本文共 3071 字,大约阅读时间需要 10 分钟。

I've just changed my OS X / Mac main user - I've created a new 'coder' user account that I want to use for development instead of my old 'lombard' account. I realized that a lot of my applications I've previously installed via Homebrew now had to be changed to be owned by the new coder user. First I ran 'brew doctor' find see what obvious issues I have:

Gerts-Mac-mini:src coder$ brew doctorWarning: /usr/local/etc isn't writable.This can happen if you "sudo make install" software that isn't managed byby Homebrew. If a brew tries to write a file to this directory, theinstall will fail during the link step.You should probably `chown` /usr/local/etcxcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.Warning: You have an outdated version of /usr/bin/install_name_tool installed.This will cause binary package installations to fail.This can happen if you install osx-gcc-installer or RailsInstaller.To restore it, you must reinstall OS X or restore the binary fromthe OS packages.Warning: Git could not be found in your PATH.Homebrew uses Git for several internal functions, and some formulae use Gitcheckouts instead of stable tarballs. You may want to install Git:  brew install gitWarning: No developer tools installed.Install the Command Line Tools:  xcode-select --installxcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.

Indeed, several files/directories below '/usr/local' were created by Homebrew as user 'lombard':

Gerts-Mac-mini:src coder$ ls -l /usr/localtotal 80-rw-r--r--   1 lombard  admin   3158  5 Jun 09:16 CODEOFCONDUCT.md-rw-r--r--   1 lombard  admin    687  5 Jun 09:16 CONTRIBUTING.mddrwxr-xr-x   4 lombard  admin    136 17 Jun 17:11 Cellar-rw-r--r--   1 lombard  admin   1253  5 Jun 09:16 LICENSE.txtdrwxr-xr-x   9 lombard  admin    306 17 Jun 17:11 Library-rw-r--r--   1 lombard  admin   1858  5 Jun 09:16 README.md-rw-r--r--   1 lombard  admin  23719  5 Jun 09:16 SUPPORTERS.mddrwxrwxr-x  12 root     admin    408 17 Jun 17:11 bindrwxr-xr-x   3 lombard  admin    102 17 Jun 17:11 etcdrwxrwxr-x   5 root     admin    170 17 Jun 17:11 libdrwxr-xr-x   3 root     wheel    102 17 Jun 17:11 libexecdrwxrwxr-x   4 root     admin    136 17 Jun 17:11 share

I can't just use 'chown -R' because I only want to change the owner of some specific files. To recursively fix/change the owner only of files specifically owned by another user, use the versatile 'find' command:

$ find . -user lombard -exec sudo chown coder {} \;

Now I just took care of the other things that brew doctor complained about:

$ xcode-select --install$ brew update

That's it! Now I'm ready to install more tools using Homebrew using the new user account.

转载地址:http://fcsja.baihongyu.com/

你可能感兴趣的文章
WinForm中跨线程操作控件
查看>>
下MFC中对象、句柄、ID之间的区别.
查看>>
如何构建Win32汇编的编程环境(ONEPROBLEM个人推荐)
查看>>
Flymeos插桩适配教程
查看>>
还在用PS磨皮去皱?看看如何用神经网络高度还原你的年轻容貌!
查看>>
大端模式与小端模式、网络字节顺序与主机字节顺序
查看>>
微信支付申请90%的商户都卡在这儿了,申请微信支付,商户功能设置详细说明...
查看>>
高仿Instagram 页面效果android特效
查看>>
2016 年总结
查看>>
将String转化成Stream,将Stream转换成String
查看>>
java路径Java开发中获得非Web项目的当前项目路径
查看>>
【工具使用系列】关于 MATLAB 遗传算法与直接搜索工具箱,你需要知道的事
查看>>
Kali-linux Arpspoof工具
查看>>
PDF文档页面如何重新排版?
查看>>
基于http协议使用protobuf进行前后端交互
查看>>
bash腳本編程之三 条件判断及算数运算
查看>>
php cookie
查看>>
linux下redis安装
查看>>
弃 Java 而使用 Kotlin 的你后悔了吗?| kotlin将会是最好的开发语言
查看>>
JavaScript 数据类型
查看>>