Category Archives: Mac

#Bootstrap your #Mac

Some time ago I started to use Boxen to manage my laptop  and here is a link and  recently my MBP was stolen and it helped me a lot and saved lots of time. Also invested effort helped me a lot to bootstrap one more MBP provided by company I was working for. 

However recently it was clearly visible that Boxen is not maintained and even GitHub switched to another tool which simplifies things a lot which is called Strap.

Strap  is based on Homebrew and Homebrew Bundle using which it’s quite easy to manage installation of required software, set up services using Homebrew Services and even applications from Homebrew Cask and applications from AppStore using mas.

If there is an interest you can checkout my GitHub repositories homebrew bundle and dotfiles.

#Java version switching on #OS X

If you have to deal with several projects that are based on different versions of Java here is how I’m solving this.

Recently I found out built-in OS X capabilities to switch between different version of Java installed on your system. After some period of time using it I come up with aliases to easily switch between Java versions installed on my machine, here are they:

alias j6='export JAVA_HOME="`/usr/libexec/java_home -v 1.6`"'
alias j7='export JAVA_HOME="`/usr/libexec/java_home -v 1.7`"'
alias j8='export JAVA_HOME="`/usr/libexec/java_home -v 1.8`"'
alias j9='export JAVA_HOME="`/usr/libexec/java_home -v 1.9`"'

Laptop from scratch with #boxen and #puppet under the hood

I believe you already heard about DevOps and Infrastructure as a Code ideas. This concept stuck into my mind some time ago for development purposes and  to manage project related infrastructure, I even gave a talk at JEEConf this year (20013), here is a link BTW Избавьтесь от рутины конфигурации окружений JEE проектов с помощью Vagrant (talk is in russian).

Well this note is something a bit different but quite closed. Recently I’ve got an idea to throw everything out of my MBP and have every software/app I need to be installed in controlled way e.g. using Boxen (source code @github). If to say in 2 words Boxen is an automation of configuration of development environments for OS X (currently there is just OS X support, Puppet that is used under the hood supports other OSs as well though).

So it took some of my spare time to back up everything I had on my laptop before, then erase hard drive and reinstall OS X from scratch. After that I cloned https://github.com/boxen/our-boxen and started my journey. There is my Boxen‘s repo https://github.com/webdizz/my-boxen with some things I have right now built and configured with it. I said some things because it’s an incremental way and it takes some time to automate parts of infrastructure I have on my laptop. Currently there are all applications, software like Git, Ruby, Java, OS preferences and configuration of apps like Emacs, Vim, Terminal (iTerm2 I’m tasting it right now). I really like a concept of dotfiles, my is here https://github.com/webdizz/dotfiles, and Boxen has quite straight forward support of it.

Additionally there is a way to amend your working space configuration with private dotfiles. For example, your SSH configuration, aliases for intranet servers etc. could be added into private dotfiles repository and easily managed with Boxen.

There are useful links to get started with Boxen:

  • http://boxen.github.com/
  • http://garylarizza.com/blog/2013/02/15/puppet-plus-github-equals-laptop-love/

Enjoy to control your laptop build process incrementally and repeatable way.

Tmux with teamocil

Several days ago I was suggested to check usage of Screen to not to switch between open tabs in Terminal.

Several words about Screen fo those who do not know what is it. There is an excerpt from Screen home page:

Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. Each virtual terminal provides the functions of the DEC VT100 terminal and, in addition, several control functions from the ANSI X3.64 (ISO 6429) and ISO 2022 standards (e.g., insert/delete line and support for multiple character sets). There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows the user to move text regions between windows. When screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would. Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill the current window, view a list of the active windows, turn output logging on and off, copy text between windows, view the scrollback history, switch between windows, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the users terminal.

But I have something more useful for me then Screen this is tmux. BTW I have a post regarding it “Tmux cheat sheet“. But here I’d like to describe what I’ve found more regarding tmux. There is a nice ruby gem teamocil for session/pane configuration with simple YAML file.

Now I have several configuration files to support my console activities on several projects at once without constant reconfiguring windows.

Here is a simple sample what can be done with teamocil.

windows:
  - name: "local"
    clear: true
    options:
      synchronize-panes: false
    root: "~/dev/projects/tasil"
    filters:
      before:
        - "source ~/.bash_profile"
    splits:
      - cmd: ["ssh tasil@vm.tasil"]
  - name: "remote"
    clear: true
    options:
      synchronize-panes: false
    root: "~/dev/projects/tasil"
    filters:
      before:
        - "source ~/.bash_profile"
    splits:
      - cmd: ["ssh tasil@some_remote_host"]

Configuration of my MacBook Pro was done using steps from this gist https://gist.github.com/4545794