August 2013

Setting Up a New Mac, My Way

Over the past couple of weeks, I've set up a few Mac OS X machines to do development of iOS and Android apps. Doing this used to be an all-day chore, but things like app stores, iCloud, and Dropbox have streamlined the process a lot.

(I could streamline the process even more by cloning an existing drive or virtual machine, but I'd rather install everything from scratch to avoid the presence of old cruft.)

As a reminder to myself, and to help out anyone else who needs to do this, here is my procedure for setting up an OS X machine the way I like it:

  1. Install/re-install OS X.
  2. During the OS X setup process, use the same login account name and password that I use on other computers, and provide the Apple IDs for iCloud and iTunes (which are different, in my case).
  3. Open System Preferences and do the following:
    • In the General panel, set Sidebar icon size to Small and Show scroll bars to Always.
    • In the Mission Control panel, uncheck the Automatically rearrange Spaces based on most recent use box.
    • In the Mouse and Trackpad panels, set all speeds to two ticks less than the maximums, and enable all the gestures.
    • In the Keyboard panel, set Key Repeat and Delay Until Repeat all the way to the right, and check the Use F1, F2, etc. keys as standard function keys box
    • In the Keyboard panel, go to the Shortcuts tab, select Services, and then enable the New Terminal at Folder service.
    • In the iCloud panel, enable everything.
    • In the Sharing panel, set the Computer Name to something unique (not "Kristopher's computer") and enable Remote Management, Remote Login, and File Sharing.
    • Set up Time Machine
    • If this is a virtual machine, go to the Desktop & Screen Saver panel and turn off the screen saver, and go to the Energy Saver panel and set the sleep sliders to Never.
  4. Use the Software Update... menu item to install any system updates that are available, and reboot if necessary.
  5. If this is a virtual machine, install VMWare Tools or Parallels Tools.
  6. Download and install these packages (using serial numbers and licenses stored in 1Password):
  7. Open the App Store app and install these applications (skipping any that are not needed):
    • Xcode
    • CodeRunner
    • OS X Server
    • Moom
    • PopClip
    • Alfred
    • Pages
    • Soulver
    • Evernote
    • Sketch
    • Skitch
    • Pixelmator
    • MultiMarkdown Composer
  8. Open Xcode, accept the license agreement and download simulators and documentation. On a Terminal command line, execute xcode-select --install to install the command-line tools.
  9. Install Homebrew
  10. Open the Terminal application and run java. Download and install the JDK when prompted.
  11. Download and install the ADT Bundle. (Note: This is old; now Android Studio is the thing to download and install.)
    • After installation, launch the Eclipse application. Choose the Android SDK Manager menu item, and install/update everything in these subtrees:
      • Tools
      • Android 4.3 (or whatever the newest API level is)
      • Extras
    • Choose Help > Install New Software.... Click the Add... button. Add this repository and install the Eclipse Color Theme plugin:
      • Name: Eclipse Color Theme Update Site
      • Location:
    • Download and install latest the HAXM driver from (If that link is broken, go to and look for a HAXM download link.)
  12. Set up ~/.bashrc to run my shared scripts that are in ~/Dropbox/bin.
  13. Execute this in Terminal: chflags nohidden ~/Library
  14. Set up ssh keys for Bitbucket and GitHub.

Then to verify everything is ready to go, I use Git to grab the source code for an iOS app, and build it and run it, and then do the same for an Android app.

(For my Windows setup, see Setting Up Windows, My Way.)

Transferring Ringtones from iTunes to an HTC One

I had some ringtones purchased from iTunes that I wanted to put onto my new HTC One. Googling for instructions found many hits, but many of those pages were a few years old, so the instructions didn't work anymore, or they didn't work with the HTC One, or were six-minute-long YouTube videos. So, I'm writing up some simple instructions that worked on my HTC One. (They will probably work with other Android phones, but I'm not promising anything.)

First, on your computer with iTunes, find the ringtones you want to transfer. These will be files with a .m4r extension. On my Mac, they were in the directory /Users/kdj/Music/iTunes/iTunes Music/Tones.

Next, you need some way to get the files onto your device's /sdcard/Ringtones directory. If you have a Windows computer, I think you can just plug the phone into the computer and it will be mounted as a USB drive, so you can just drag and drop the files. If you have a Mac, you can either use the Android File Transfer application, or use something like Dropbox.

Finally, you need to change the filename extensions of the files in /sdcard/Ringtones from .m4r to .m4a.

Then, on the device you can go to Settings > Sound > Ringtone, and you should see your ringtones in the list.

Solving "Symbol not found: _Perl_Gthr_key_ptr" When Running git-svn on Certain Unnamed Operating System Beta Versions

Let's say that you are using a beta version of a new operating system that you can't name because it is covered by a non-disclosure agreement, and you have also installed the newest version of its development tools, which are also covered by NDA, and when you try to run the git svn command, you get this output:

dyld: lazy symbol binding failed: Symbol not found: _Perl_Gthr_key_ptr
  Referenced from: /usr/../Library/Perl/5.12/darwin-thread-multi-2level/auto/SVN/_Core/_Core.bundle
  Expected in: flat namespace

dyld: Symbol not found: _Perl_Gthr_key_ptr
  Referenced from: /usr/../Library/Perl/5.12/darwin-thread-multi-2level/auto/SVN/_Core/_Core.bundle
  Expected in: flat namespace

error: git-svn died of signal 5

Apparently, the problem is that git-svn is implemented in Perl, and there is something wrong with the Perl configuration used when you run /usr/bin/git.

What do you do?

It turns out you can fix this by putting the Git executables provided by the new development tools at the head of your PATH, by executing this command (or adding it to .bashrc):

export PATH="/Applications/":$PATH

where is the unnamed development tool.

Alternatively, you can add all the command-line tools to your PATH like this:

export PATH=”/Applications/”:$PATH

Credit to Vandad Nahavandipoor for the hint.

Another option would be to use the xcrun utility to run git. You can do this:

xcrun git svn blah-blah-blah

or put this into your .bashrc so that you don't have to remember to type xcrun:

alias git='xcrun git'

If you are the kind of person who thinks its a good idea to replace system files with symlinks, you might try symlinking /usr/bin/git to /Applications/ However, that alone doesn't work, because Git will still run the git-svn executable from its default location, /Library/Developer/CommandLineTools/usr/libexec/git-core, and you will still have the _Perl_Gthr_key_ptr problem. So you also need to symlink the default location to /Applications/, or set the GIT_EXEC_PATH environment variable.