Setup for transparent SSH with iTerm and AppleScript

I use my MacBook as my main machine from which I access daily a number of servers that I use for development, experimentation, and maintenance. Since I do all my job from the terminal, I end up using SSH extensively. One major issue I have encountered is that SSHing different servers entails (i) having a mental map of which terminals correspond to which machines, and (ii) the overhead of introducing a SSH line immediately after opening a new terminal window. Although this can be mitigated by merely using zsh’s substring history search, aliases, etc., I found it easier to offload the responsibility to my muscle memory. In this post, I will describe my setup which, after over a month of being in production, has proved to make my life easier.

Continue reading

Loading iTunes library from command line

Having separated iTunes libraries for different setups (e.g., media center, local music, remote playlists) is a powerful way to organize your media library and share resources among different devices (e.g., iPhone synchronization), but it can be painful. While it is possible to load a different iTunes library by opening iTunes and pressing “Alt” at the same time, this is not optimal. Ideally, we would write a script to pass iTunes the library it should load at launch time (e.g., open /Applications/iTunes.app –load-library=$LIBRARY_PATH). However, to the best of my knowledge, the iTunes API does not expose this – which I honestly do not understand. Googling for a workaround I could not find a good/complete solution, so I made my own. Here you have the setup and the scripts that implement it.

Continue reading

Maintaining an updated version of vim

I use vim for development. More concretely, I use YADR, a fork of dotfiles for my zsh, git, vim, etc. setup. One of the vim plugins that I use the most is neocomplete, which provides simple but powerful autocompletion. One of the last commits in neocomplete introduces a problem that impedes correctly wrapping lines – normally set to 80 characters (issue here). It turns out that it was vim, not neocomplete that triggered this unwanted behaviour. This vim patch, fixes the issue, but the binary cannot be obtained for neither MacOS nor Ubuntu – which are my main OSs – via standard repositories. Thus, I decided to find a way to keep my vim updated so that I can easily patch future problems.

Continue reading

Update OpenSSL in OSX

While having an updated version of OpenSSL is always recommended, vulnerabilities such as The Heartbleed Bug reported 7th of April 2014 reminds us of it. Also, not counting on an updated version can cause some packages not to install (e.g., IO::Socket::SSL, necessary to run git send-email). In this post we go through the steps of updating OpenSSL in OSX, which as usual, entails a few more steps than in linux. I use Homebrew as a package manager.

Continue reading

Parallels 9 for Mac improving guest – host communication

As most of my post containing tips, this one is also about how to integrate MacOS with a proper Linux developing environment without introducing a big overhead. The obvious question here would be: Why don’t you fully move to Linux and forget about having to integrate your everyday OS with your developing environment?  Well, we all have our preferences and motives, which are not the goal of this post. For those who use a similar setup as mine here comes good news: Parallels 9 successfully approaches one of the biggest issues I have found when dealing with Virtual Machines (VMs) under MacOs: Sharing the file system between the host and the guest machines.

Continue reading

Best tools to get more out of your fingers in your mac

Depending on the task you are carrying out, you want you fingers either in your keyboard or in your mouse; and you want them to stay there. When I am programming I want to forget about my mouse and this implies that I should be able to open new terminals, navigate the code or check Stack Overflow without missing it. On the other hand, when working on my pictures, I want to prescind as much as I can from the keyboard, or at least limit my interaction with it to only one hand. Today I will tell you about the tools I use that allow me to feel comfortable working on my mac; from mapping gestures and shortcuts to choosing the speed of a certain key repetition.

Continue reading

Non case-sensitive Mac OS Extended formatting colliding with git clone

If you use Mac OS for development and have ever experienced that cloning a GIT repository produces instant non staged changes for commit then this is your post. Here I will explain the underlying problem for this GIT weird behaviour and propose 2 solutions: (i) lazy i-don’t-want-to-format-my-mac, and (ii) I want to do things right. So, let’s get started.

Continue reading

Recover command line after upgrading Mac OS – Installing Command Line Tools (Lion & Mountain Lion)

I love Apple and use my MB Pro for everything, from my personal everyday: mail, calendars, Facebook, etc. However, each time a new version of Mac OS is released, the SO moves further and further from Unix, and therefore from “standards”.

One of the consequences of this -among others- is that the known in linux OS as /bin moves around, making our .bashrc (yes, we do have that in Mac OS too) useless every time we upgrade. Since trying to add to the $PATH all the different folders each upgrade moves around is extremely painful, here it is an useful tip to recover the system commands from the terminal (e.g. git, gcc, javac, etc). (Please note that your own scripts, commands and binaries will remain the same and totally accessible as log as they are part of your $PATH).

Continue reading