From Markdown To Pastable Formatted Text In OS X Terminal

By Tuesday, August 4, 2015 0 , , Permalink 3

I use Markdown a lot. I use it right now, to compose this post 🙂 . It’s my go-to syntax for quick plain text files for notes and such. It’s what I use when I code something that outputs “formatted” text to terminal.

Recently, I wanted to take Markdown output from a script I wrote, and send a nicely formatted version of it by email.

Read on for the solution I eventually came up with, after several iterations, and essential tips from Brett Terpstra, the Markdown Master.


cat | \
  pandoc --from markdown --to html | \
  textutil -convert rtf -stdin -stdout -format html | \
  pbcopy -Prefer rtf

Continue Reading…

Starting Terminal In the Current Directory In OS X Finder

I use the terminal on OS X a lot. I also use Finder to navigate the file system. Sometimes I want to start a terminal session in the current Finder location. To do it, I found the cd to… app.

Last year, when I was mainly on Windows, I showed how to use AutoHotkey to launch the command prompt from anywhere. Now that I’m mostly on OS X, the terminal is even more useful than the command prompt on Windows. It’s only natural that I want similar access to it.

The cd to… app does something similar. When executed, it opens a new terminal window, at the active Finder location. The app can live in the Finder toolbar for quick one-click access. I prefer staying at the keyboard as much as I can, so I rather invoke it with Spotlight, or using a keyboard shortcut assigned to launch it.

This is part of my Mac Power User Training series. Follow it to see how I try to go from Mac novice to a pro.

Continue Reading…

How To Assign Keyboard Shortcuts For OS X Apps

As much as the trackpad is powerful on Mac, I still prefer not to leave the keyboard if I can. For that reason, I want to assign keyboard shortcuts to the rare few apps that deserve it. Imagine my surprise when I realized it’s not a straight forward action in OS X!

In this post I describe how to assign arbitrary keyboard shortcuts to launch OS X apps, without any third-party software or AppleScript. The solution is based on creating an Automator Service workflow to launch the desired app, and assigning a keyboard shortcut to that service.

I imagine there are simpler solutions that take advantage of some third party automation software or AppleScript. Feel free to let me know about your preferred solution, even if it involves such demons.

I am aware that I can use Spotlight to launch any application by typing the first letters of its name. Indeed, this is how I launch 99% of apps. There are very few cases where it makes sense to bypass Spotlight with a shorter key-combo – and this post is for these cases.

This is part of my Mac Power User Training series. Follow it to see how I try to go from Mac novice to a pro.

Continue Reading…

Fixing Homebrew on OS X Yosemite

Homebrew is “The missing package manager for OS X”. It’s pretty great. Unfortunately, upgrading to OS X Yosemite might break it, as it did for me.

There are several paths for fixing it, depending on when you realize it’s broken. Here are a few possible fixes that you can use.

If you just want the bottom line, here it is:

  1. If you still haven’t upgraded to OS X Yosemite, run brew update before the OS X upgrade.
  2. If you already upgraded OS X and your Homebrew is broken, run git pull from /usr/local, and then run brew update.

Read on for more details on my experience with the break and fix.

Continue Reading…

Local WordPress Sandbox With Bitnami On OS X

By Monday, October 27, 2014 0 , , Permalink 1

Whether you want to start your own WordPress-powered site, or you’re a WordPress developer – a local WordPress installation is a useful tool. Luckily, with the Bitnami WordPress stack, it’s also a breeze to set up!

WordPress, as a PHP-based web application, requires a full-blown web stack to run. At the very least, you’ll need a PHP-enabled web server, and a database engine. An often-used combination is the LAMP stack, which stands for Linux, Apache, MySQL & PHP.

Setting up a full stack on your own is definitely possible. For most, it’s not considered a fun way to spend an afternoon (or a weekend, if things get hairy). Got several computers with different OSes? Expect a completely different experience with each one…

Enter Bitnami. In a nutshell, Bitnami provides pre-configured, self-contained, application stacks for many popular web applications. And they do it for Windows, Linux, and OS X! Want to install a local WordPress stack? Simply download the installer for your platform, run it, and rejoice!

This short how-to post demonstrates installing a WordPress Bitnami stack on OS X.

Continue Reading…

The Right Way to Get the Directory of a bash Script

By Wednesday, October 8, 2014 0 , , , Permalink 4

When writing bash scripts, you might want to get the directory that contains your script. There are multiple ways to accomplish that. Due to the flexibility of bash, some solutions work in some cases, but not in others.

In this post, I evolve from a naive solution to a robust and consistent solution for this common problem. Spoiler – a “good enough” middle ground that I often use is "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )", as long as I know that symbolic links are out of the game.

Continue Reading…

Manage Windows In OS X Like a Boss With Spectacle

I hate using the mouse or trackpad on my MacBook to manage open windows. When using multiple monitors, I move windows between the monitors and resize them all the time. That’s why my mind was blown when I found out about Spectacle.

Spectacle is light, simple, and open source. It does one thing – control window size and position using keyboard shortcuts. It does it well. I installed it a couple of days ago, and I just can’t remember how I was able to work without it.

This post is part of my Mac Power User Training series. Follow it to see how I try to go from Mac novice to a pro.

Continue Reading…