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 doctor
Warning: /usr/local/etc isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a brew tries to write a file to this directory, the
install will fail during the link step. You should probably `chown` /usr/local/etc
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.
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 from
the OS packages. Warning: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
brew install git Warning: No developer tools installed.
Install the Command Line Tools:
xcode-select --install
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.

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

Gerts-Mac-mini:src coder$ ls -l /usr/local
total 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.md
drwxr-xr-x 4 lombard admin 136 17 Jun 17:11 Cellar
-rw-r--r-- 1 lombard admin 1253 5 Jun 09:16 LICENSE.txt
drwxr-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.md
drwxrwxr-x 12 root admin 408 17 Jun 17:11 bin
drwxr-xr-x 3 lombard admin 102 17 Jun 17:11 etc
drwxrwxr-x 5 root admin 170 17 Jun 17:11 lib
drwxr-xr-x 3 root wheel 102 17 Jun 17:11 libexec
drwxrwxr-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 ch
own 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.

Recusively change the owner of files (chown) on Mac OS X的更多相关文章

  1. Mac OS finder : 显示和隐藏文件[夹] show and hide files or folders

    Finder默认是不显示隐藏文件[夹]的,要显示出怎么办? 要显示的话,可以GUI(graphic user interface)和CLI(command line interface)两种方式 CL ...

  2. Link all references for a local rename (does not change references in other files)

    这是一个十分easy的问题 错误原因  : import  Android.R; 把这句话去掉 ctrl + shift+o  引进一个  项目对应的R文件 R存在于gen文件夹下 可以找到 layo ...

  3. linux basic commands

    1. man - an interface to the on-line reference manuals $man man 2. apt - advanced package tool SEE A ...

  4. File System Shell

    Overview appendToFile cat chgrp chmod chown copyFromLocal copyToLocal count cp du dus expunge get ge ...

  5. Step one : 熟悉Unix/Linux Shell 常见命令行 (一)

    1.文件系统结构和基本操作 ls  - - list directory contents -a/A 列出全部文件(包含隐藏文件) - i 列出inode号码 -n 查看UID and GID -d ...

  6. 【转载 Hadoop&Spark 动手实践 2】Hadoop2.7.3 HDFS理论与动手实践

    简介 HDFS(Hadoop Distributed File System )Hadoop分布式文件系统.是根据google发表的论文翻版的.论文为GFS(Google File System)Go ...

  7. 【大数据系列】FileSystem Shell官方文档翻译

    appendToFile cat checksum chgrp chmod chown copyFromLocal copyToLocal count cp createSnapshot delete ...

  8. hadoop 文件操作

    Create a directory in HDFS - mkdir The hadoop mkdir command is for creating directories in the hdfs. ...

  9. Ubuntu notes

    ubuntu notes Table of Contents 1. backup data 2. Basics Ubuntu 3. Install, uninstall packages 4. Bas ...

随机推荐

  1. Mac通过wifi连接 Android设备

    公司用的全是mac开发,但是全是type-C接口,每次背电脑回家啊,还得带个数据线转换器…… 想着回来,直接通过Wi-Fi连接手机就好,发现完全忘了之前套路,现在赶紧记下一波,保证包教包会! STEP ...

  2. iOS开源项目:FlatUIKit

    FlatUIKit是iOS中具有扁平化风格的UI(Flat UI)组件.FlatUIKit的设计灵感来源于Flat UI和Kyle Miller.FlatUIKit中的组件是通过扩展(category ...

  3. Django文档学习

    文档位置:https://docs.djangoproject.com/zh-hans/2.1/

  4. OpenCV学习(3) OpenCV框架

          OpenCV是一个开源的视觉库,其中包括很多计算机视觉的算法实现.在版本2.2以后,OpenCV采用C++特征的API,在1.x版本中,OpenCV函数都是传统的C语言形式.       ...

  5. longest-palindrome

    https://leetcode.com/problems/longest-palindrome/ public class Solution { public int longestPalindro ...

  6. [置顶] 一个Web报表项目的性能分析和优化实践(一):小试牛刀,统一显示SQL语句执行时间

    最近,在开发和优化一个报表型的Web项目,底层是Hibernate和MySQL. 当报表数据量大的时候,一个图表要花4秒以上的时间. 以下是我的分析和体会.  1.我首先需要知道哪些函数执行了多少时间 ...

  7. jquery ajax方式直接提交整个表单

    $.ajax({ type: "POST", url: url, data: $('#form1').serialize(), success: function(msg){ al ...

  8. STL - C++ 11的Lambda表达式(上)

    Lambda始自C++ 11,是一种在表达式或语句内指定函数行为的定义式. 你可以定义函数行为作为对象,以inline实参的形式传给算法作为predicate(判断式). eg: std:transf ...

  9. linux安装卸载软件

    转自:http://www.cnblogs.com/propheteia/archive/2012/06/26/2563383.html configure作用:是源码安装软件时配置环境用的 他根据你 ...

  10. 【树莓派】树莓派raspi-config配置

    发现有些树莓派盒子,输入的结果和键盘的实际字符有差异,比如输入 | ,结果显示为 ~. 这是因为树莓派的键盘设置问题. 可以通过设置raspi-config进行配置: 第一次使用树莓派的时候需要进行一 ...