Wednesday, June 18, 2014

Recusively change the owner of files (chown) on Mac OS X

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/', 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/', 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/', 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
-rw-r--r--   1 lombard  admin    687  5 Jun 09:16
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
-rw-r--r--   1 lombard  admin  23719  5 Jun 09:16
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.

Saturday, April 12, 2014

Another Note To Self: Setting up the Mac Mini

Sublime Text 3:

I'm using Sublime Text as my default editor on Mac and Windows (replaced Notepad++ about a year ago as my favourite editor on Windows). One of the things I like about Sublime is that the plugins are written in Python. I haven't tried creating my own plugin but I am trying to use Python more so this is one more thing to keep in mind.


This time I'm not going to install the Xcode Command-Line Tools just to get git.

Two easy alternatives seem to be:
1. Install GitHub for Mac and install the Git command-line from the Preferences menu
2. Use Homebrew to install git.

I've opted for option 1. This installs the git binary to /usr/local/bin/git. You need to add the /usr/local/bin directory to your path.

Next I installed SourceTree.


I want a dark theme for the OSX Terminal and found:

curl -O

In Terminal, import the settings with Command+O and select the Solarized file. This gives me a basic dark theme. Not completely happy with it yet but it's a start.

Saturday, February 01, 2014

Note to self: Upgrading to OS X Mavericks

After upgrading to OS X 10.9 (Mavericks) I had to do the following to get Android Studio working again:

  • Update Xcode to the latest version
  • Activate the Xcode Command Line Tools license for example by running on the shell `sudo gcc` and accept the license. Now git should work.
  • Install Java 6 when prompted automatically after trying to launch Android Studio.
  • Need to update VirtualBox for Genymotion to work. Use `Oracle VM VirtualBox Manager` to download the latest VirtualBox.

Thursday, January 23, 2014

I need a quiet office

I really struggle to concentrate / focus (i.e. to "get into the zone") when trying to develop or read something technical while people are talking around me in the office. Perhaps the open plan layout works for some people, but I find it very distracting. (And I'm very guilty myself of causing distraction for others as well!)

I think ideally some of the office space should be divided into a few smaller work areas to be used by small teams that prefer to have privacy.  For example, I'm currently working with a small team (3-5 developers) and we occasionally need to communicate with a remote office via Skype and a webcam. Ideally we shouldn't have to go to a meeting room every time we want to have a chat with the remote team members.

At a very least, I wish we had several small 1-person private guest offices for us to use when we need privacy. That way I can keep my desk in the open office, but get away for 3-4 hours a day for productive work.

The only way I can fight the distraction, is to listen to music while I work. But this only works for certain type of tasks (like unit testing). When I really need to focus (like learning/reading or designing/writing code), I want no distractions. A single sentence on the other side of the office can bring me out of the "zone".

If you Google search for "open plan office productivity" you'll immediately see lots of evidence that Open Plan doesn't work for everyone. (It seems like younger people like open offices more, presumably because it feels more social).

A systematic survey of research upon the effects of open plan offices found frequent negative effects in some traditional workplaces: high levels of noise, stress, conflict, high blood pressure and a high staff turnover.[7] The noise level greatly reduces the productivity, which drops to one third relative to what it would be in quiet rooms ... A balance between the office types may be found by employees having an open setting with part-time access to a quiet workspace.
Or from
a growing body of evidence suggests that the open office undermines the very things that it was designed to achieve. ...  In laboratory settings, noise has been repeatedly tied to reduced cognitive performance.
More links: