Saturday, November 08, 2014

How to configure OSX 10.10 Yosemite for software development

One Happy Kitty by andedam from flickr (CC-NC-SA)

It's been a few OSX updates since I wrote my guide for 10.5 and about half of it changed. Here's updated list of steps necessary to turn fresh OSX 10.10 into a sensible machine for creating software.

The guide below is based upon my preference, so details will vary for you, but a lot of Apple's default settings are uncontroversially horrible, so you're probably better off starting with a guide like this than trying to figure out where are all the options yourself.

Basics

  • Install some sensible browser like Chrome or Firefox.
  • Install some kind of AdBlock. If you sign in into your Google account with Chrome it might even install AdBlock for you.
  • Install whichever cloud sync service you're using like Dropbox, Copy, etc. And start syncing your stuff.
  • Install iTerm2 for sensible terminal emulator.
  • Clean up all crap from dock. Other than Launchpad and System Settings, everything else should be gone. Add iTerm2, your browser, and your text editor, and any application you wish to install there instead of stock Apple crap.
  • It's also a good idea to disable Spotlight as soon as possible by running sudo mdutil -i off / - before it tries to index all of your dropbox and generally ruin performance of your machine.

Editor

Install some sensible text editor like Sublime Text (requires license key).

Whichever editor you choose, you'll definitely need to configure it to your liking.

Then symlink it so you can use it from command line

  mkdir -p ~/bin
 ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl.

Settings

Default Mac settings are totally awful, time to fix that.
  • Max brightness
  • Settings > Security > Allow apps downloaded from: > Anywhere
  • Settings > Mouse > Max out "Fast" setting on everything
  • Settings > Keyboard > Key Repeat > Fast
  • Settings > Keyboard > Delay Until Repeat > Short
  • Settings > Keyboard > Use all F1, F2, etc. keys as standard function key
  • Settings > Sound > Disable "Play user interface sound effects"
  • Settings > Sound > Alert volume > 0% (for Terminal ping)
  • Settings > Trackpad > Scroll & Zoom > Disable "Scroll direction: natural"
  • Settings > Energy Saver > Disable "Automatic graphics switching"
  • Settings > Energy Saver > Power Adapter > Computer sleep > Never
  • Settings > Energy Saver > Power Adapter > Display sleep > Never
  • Settings > Displays > Turn off "Mirror Displays"
  • Settings > Displays > Set "Best for display" for every external monitor
  • Settings > Displays > Built-in Retina Display > Disable "Automatically adjust brightness"
  • Settings > Displays > Arrangement > drag and drop your external monitors into desired order
  • Settings > Dock > enable "Automatically hide and show the Dock"
  • Menu bar > Battery icon in task bar > Enable "Show Percentage"
  • iTerm > Preferences... > Profiles > Terminal > Unlimited Scrollback

Drivers

OSX already includes drivers for laptop itself, but you might need some for peripheral hardware.

If you need any keyboard drivers like for Microsoft Keyboard (otherwise Cmd key is in the wrong place) or just about any external keyboard, get necessary drivers.

If you need any special keyboard layouts, get them too.

Standard paths

OSX renames a lot of directories. While in theory scripts could just use env vars to find proper paths, it's more reliable to symlink all the things:

  sudo ln -s /Volumes /mnt
  sudo ln -s /Volumes /media
  sudo mv /home /home-old
  sudo ln -s /Users /home

Development tools

First, you'll need Xcode, which annoyingly requires App Store login these days. Then select "Command Line Tools (OS X 10.10) for Xcode" package or run xcode-select --install from command line to do so.

Now it's time for a package manager. They're all somewhat disappointing if you're used to apt-get. homebrew seems somewhat more popular than others these days, so you might just as well try that.

You'll also need X11 server like XQuartz.

Create new SSH key pair

Open Terminal and run ssh-keygen to create ~/.ssh/id_rsa, then upload the generated key to any place that needs to know about it like github, bitbucket, or whatever else you use.

Checkout your dotfiles

Hopefully you're storing your dotfiles somewhere. If it's a git repository, or your Dropbox account, get them now and symlink them all properly.

If there are any other repositories you might need, checkout them too.

Install homebrew packages

Your list might vary. Here's mine (fun story - order you install homebrew packages matters, every packaging system that's not apt-get sucks so hard):

brew install mongodb mysql postgresql rbenv ruby-build wget htop unrar mc mplayer coreutils libxml2 libxslt bash poppler redis qt youtube-dl trash rabbitmq pcre exiftool lame id3v2 sox jq git bash-completion p7zip

Then enable all services you installed, unless you want to start them manually:

  ln -sfv /usr/local/opt/*/*.plist ~/Library/LaunchAgents/

And install non-system ruby, so you can install gems without sudo:

  rbenv install 2.2.0-dev
  rbenv global 2.2.0-dev

Due to OSX limitations you'll need to make htop suid if you don't want to use it with sudo every time. Instructions for that will be printed during installation or you can get them with brew info htop.

Sane bash and coreutils

bash version shipped with OSX is ancient and BSD utilities are all awful. In previous steps you installed proper versions, now you need to tell the system to use it.

Add homebrew version of bash as allowed shell by appending /usr/local/bin/bash at end of /etc/shells

Then set it as your shell: chsh -s /usr/local/bin/bash $USER

Then make sure to add GNU coreutils to your PATH:

  export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

You'll also probably want to touch ~/.hushlogin to prevent some worthless spam on every open terminal tab.

Install gems

Again, your list my vary. Here's mine:

gem install beeminder moneta octokit term-ansicolor pry-plus rak objectiveflickr hpricot color nokogiri bundler

All other software

Sadly OSX window manager is extremely dubious for keyboard use. Fortunately programs to make it usable exist. I recommend installing these two:
* ShiftIt - for tiling by keyboard shortcuts.
* HyperSwitch - for sane alt-tab window switching. (there's also Witch, but it has issues with 10.10)

Giving them necessary access moved in 10.10. Now you'll need to:
* Settings > Security & Privacy > Privacy > Allow the apps below to control your computer > enable them both

You'll probably need these or similar programs:
* Any number of IM programs (unless you use in-browser hangouts only)
* Tor Browser
* Transmission - torrent client
* OpenOffice - office software
* VLC - media player
* MplayerX - another media player
* Xee - image viewer (only older version is open source)
* GitX (L) (original GitX is abandoned, this is reasonably alive fork)

Open Source Mac website contains links to other software you might need.

You'll probably need Java for something.

Enjoy

Once you go through this list, and successfully get everything going, I'd recommend modifying it to your liking and reposting your version on your blog. Everybody's needs are different, so guide like this is just a starting point.

No comments:

Post a Comment