Managing users and groups from the OS X terminal

I was recently playing around with SaltStack and wanted to create a salt user and group to run the master. This led me to learn some basics of user and group management on OS X, and I thought I’d put them here to remember. FYI I did all this on Yosemite, but it seems like this is the way things have worked for a while, so it should work on just about any OS X system that’s still running I would think. No guarantees though.

Continue reading

Executing your code from Vim

My girlfriend is currently learning Python, and using Vim as her text editor (because she’s a boss). She told me this morning that she was quitting Vim to run her code each time she changed it, which was becoming annoying. I showed her a couple of methods to do this and thought I’d quickly document it for her and others. We both run Macs, and run Vim from Terminal/iTerm, but this should at least point you in the right direction if you’re running a different OS. Also, the examples below use Python, but should work equally well for similar scripting environments like Perl or Ruby.

Continue reading

More Fun with KeyRemap4MacBook

Recently I wrote a post on how to remap your Caps Lock key in a context sensitive way using KeyRemap4MacBook. Since then (just now) I have started to use my Mac laptop with an external keyboard. Not anticipating any issues, I got a little scared when the key remap I’d spent a while investigating and setting up didn’t work. It is with great relief that I now post the solution. You also get a bonus tip if you make it to the end of the post.

Continue reading

Caps Lock for Terminal Junkies Using OSX

It’s been a couple of years since I’ve owned a Mac, but now I’m happily back in Apple’s clutches. During the intervening period between owning my last Mac and this one, I fell in love with remapping the Caps Lockkey to be another control key. Given that I spend a fair chunk of my day in Vim and a terminal, this saves alot of strain on my pinky finger and puts an otherwise useless key to good use. However, now that I’m back in Mac land I faced a dilemma: should Caps Lock be the control key, or the command key. You see, I’ve become very use to hitting caps+c/v to copy and paste, but Apple, bless their infinite wisdom, have a command key that is used for this purpose. What’s a geek todo?

Continue reading


While at home sick today I fired up Firefox to watch some videos on my media centre PC and was quickly disappointed to hear the audio coming from the laptop’s speakers rather than through my television. XBMC on this machine uses HDMI for audio out, and has since I set it up, so I was confident that it was just a matter of configuration. After some messing around trying to find config windows in XFCE and searching the world wide web, I found a post mentioning pavucontrol. Hoping pavucontrol offered a solution I installed it and launched it from the command line. It gave me a nice GUI as seen below, and more importantly, allowed me to configure the output device that PulseAudio should use by default.

screen capture of choosing HDMI output in pavucontrol GUI

After I’d enjoyed my video, I thought I should try and gain at least a cursory understanding of what I’d just done. Wikipedia came to the rescue with a high level description of PulseAudio, and a helpful diagram that shows where it sits in the grand scheme of things. One thing that really caught my eye was the following; “One of the goals of PulseAudio is to reroute all sound streams through it…”. With that in mind I’m guessing that a fair few applications on my system are using Pulse, but I’d just never noticed the issue because I could configure XBMC to use a specific output (it has an independent sound system?). In any event, I hope this helps some other confused soul to get their audio pumping through HDMI.