fzf – Command-line Fuzzy Finder on macOS X

If you master your Terminal it always looks like you are a superhero. Therefore, I always try to present a lot using terminal during my lecture, just to provide some smoke and mirrors.

However, I am far away from mastering Terminal truly. Therefore, it comes in handy that one of my students pointed me to reverse-i-search which is available on Terminal.

Wich this reverse lookup you can search through previous commands used in Terminal before. While this is an awesome feature you can activate by control-r on macOS, it does not allow you to search for similar commands used before. It always shows just exact matches of what you typed.

reverse-i-search on macOS

To search through similar typed commands, you can use fzf, a command-line fuzzy finder available at GitHub.

It’s an interactive Unix filter for command-line that can be used with any list; files, command history, processes, hostnames, bookmarks, git commits, etc.

Installing on macOS using Homebrew

For your convenience you can install fzf using Homebrew using the command

brew install fzf 

For me, the bash integration was not available after the installation. After some investigation (I might haven’t read the instruction well enough), I realized the installation script needs to be run:

/usr/local/opt/fzf/install

Eventually, the installation routines put [ -f ~/.fzf.bash ] && source ~/.fzf.bash into .bashrc. I run into this issue some time before. Reading through this article on Scripting OS X might give you an idea why it does not run.

When you open a terminal application, it does not ask for login. You will just get a command prompt. In other versions of Unix or Linux, this will not run the .bash_profile but a different file .bashrc. The underlying idea is that the .bash_profile should be run only once when you login, and the .bashrc for every new interactive shell.

However, Terminal.app on macOS, does not follow this convention. When Terminal.app opens a new window, it will run .bash_profile. Not, as users familiar with other Unix systems would expect.bashrc.

Moving the line mentioned above into .bash_profile and deleting .bashrc eventually solved the issue. After restarting Terminal the key bindings CTRL-R and CTRL-T have been available as expected.

fzf command-line fuzzy search

With this little trick the installations of fzf works quite well on macOS X Mojave.

tl;dr

Use reverse-i-search by pressing control-r on macOS to search previous commands typed in Terminal. In addition, you can use fzf, a command-line fuzzy finder to find similar commands and all other kinds of stuff.

To install run

  • brew install fzf
  • /usr/local/opt/fzf/install
  • copy [ -f ~/.fzf.bash ] && source ~/.fzf.bash from .bashrc into ~/.bash_profile (and remove .bashrc if not needed) or source .basrc from .bash_profile

Link: https://github.com/junegunn/fzf

Blogging again with MarsEdit

Since WordPress cam up with the new editor, actually, writing does not spark fun anymore. Actually, I do not know why I do not like the new editor. Therefore, I recalled MarsEdit, which I used quite some time ago.

MarsEdit 4

I am still not disappointed by the editor. Connection the WorPress installation worked like a charm. Looks like I can start writing blog articles again in a “traditional” manner. 

MarsEdit 4 Editor

Said that, this is going to be the first article written with MarsEdit for a long time.

Preview as PDF Viewer for LaTeX Workshop on Visual Studio Code on macOS

After switching to Visual Studio Code as LaTeX editor, I installed the LaTeX Workshop extension to gain decent support for editing LaTeX files on Code.

After fiddling around with the settings, I still was not able to use Preview on macOS.

First of all, make sure external PDF viewers are enabled in the user settings.

"latex-workshop.view.pdf.viewer": "external"

Furthermore, set Preview es external viewer. The trick here is, don’t think about Preview as a viewer, actually, it is the open command.

Just set up the viewer as you would start preview on a terminal.

open -a preview mybook.pdf
This command used for user settings eventually ends in the following section.
"latex-workshop.view.pdf.external.command": {
    "command": "open",
    "args": [
        "-a",
        "preview",
        "%PDF%"
    ]
}
With these settings, Preview will spawn with the created PDF right out of Visual Studio Code.

Fixing the GPG Crash on Yosemite

Since upgrading to Yosemite, I have trouble running GPGMail with my Mac. When hitting the New Mail button Mail simply crashes.

GPG New MailThere is little I can do, and I almost gave up. The logs don’t help that much, though.

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<HeadersEditor 0x7fb0b6584680> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _composeHeaderView.'
abort() called
terminating with uncaught exception of type NSException

However, there is this single thread in the GPG support forum, someone had the exact problem, while support pointed out there is some Yosemite beta of the GPG tools. Just in time,  GPG Suite Beta 4 was released, and it works like a charm.

GPG Suite Beta 4 workingIn case you are looking for the public key, pick it up here.

 

RDP from Mac to Ubuntu

I am currently in the progress of moving my entire home automation server from Windows 2003 to a Ubuntu LTS. However, connecting to the new server via SSH is quite painful. As I am using openHAB including the Eclipse-based editor, I would prefer to connect to the server from Windows and Mac via RDP.

I tried quite a while using XRDP, but almost gave up as I always had trouble, either not being able to connect or having no desktop at all.

Therefore, kudos to Mike Rehner, who came up with a step by step guide how to install and cofigure XRDP on Ubuntu.

20 minutes absolutely worth watching, especially as he comes up with two or three hints, I haven’t foundon any other tutorial so far such as

  • you are going to need a 2D desktop such as MATE Desktop Environment
  • you need to connect several times using the RDP as the first or second attempt might fail
  • how to change the XRDP settings to be able to connect to previous session

The proof, I was able to connect to the Ubuntu via my Mac, though:

XRDP Mac OS X Ubuntu

 

Where is my Space

Using Bootcamp, running a Mac OS X and a Windows installation in parallel, space is slowly but constantly running low on my MacBook Pro. Before upgrading my HDD, I was looking for a better way than using du or df -h to check where I might free up some space on my disk.

Disk Inventory X is a free tool available using cushion tree maps to visualise the disk usage. A similar tool was developed at the Technical University of Eindhoven named SequoiaView. While SequiaView was developed for Windows, Disk Inventory X is designed for Mac OS, working fine with version 10.8.3.

Disk Invetory X

After selecting the disk, it’s possible to browse through the directory structure analysing where your storage when to.

Disk Invetory X Cushion Tree

Both, SequoiaView for Windows and Disk Inventory X for Mac are quite useful programs that should be definitely part of ones toolset.

Make it cozy – MacBook Pro and the third Monitor

A couple months ago, we got a second 24” monitor for each developer at the company I worked for. At that particular time, some of the developers still used some old 15” monitors as a second monitor. I spend quite some time to explain why it is important for companies to provide a good great work experience. You should aim at making your employees feel comfortable at work.  Following Starbuck’s a third place between work and home employers should try to keep the workspace as attractive as possible to their folks. Starbuck’s would not succeed with over 17,000 stores if the place where you can stay would not be attractive, though.

Said that, below is what my current home office workplace looks like right now. My Almost-Retina-But-Then-Again-Bought-To-Early-MacBook Pro, two external monitors with a total resolution of 1920×1200 + 1680×1050 + 1920×1200 and an Icy Box for easy swapping external 2.5” and 3.5” HDD drives and the  ElevationLab low friction iPhone dock, I backed at Kickstarter.

I run both, Windows 8 and MacOS Mountain Lion on my MacBook, depending what I need to do, I switch between both operating systems, all peripheral devices fully supported.

MacBook Pro Three Monitor Support Windows 8

To get the third monitor working, I recently got a Kensington Universal Multi-Display Adapter from Amazon.de. Before attaching the device, make sure to download and install the latest drivers (both, for Windows 8 and Mountain Lion) from the DisplayLink website. If you do not install these drivers on Windows 8 beforehand, you might experience problems as there are already drivers offered by Windows Update. DisplayLink already provides support in case you experience any issues here.

Kensignton Univeral Multi-Diplay Adapter

I was quite surprised, DisplayLink already offers Windows 8 drivers. Quite skeptical about the external graphics card using USB as I read a lot about latency and quality, both, the quality of the device as well as the support for Windows 8 and Mountain Lion are just great. I do not experience any latency (I do not play games on the external monitor, though) so far and the quality of the output absolutely satisfying.

Boot Camp Windows 8 – Me haz Drivers?

Works on my MachineYou own a MacBook Pro? You run Boot Camp? You run Mac and Windows? You want to upgrade to Windows 8 but you still hesitate because Apple has not released a new Boot Camp version supporting Windows 8? First of all: I did it. I have to admit, I haven’t spent a single though on drivers before I upgraded to Windows 8 – and still I just blog from Windows 8 on my MacBook Pro.

What happens when I upgrade?

If you upgrade, some devices will work some won’t.Even if the Microsoft Upgrade Assistant does not show any incompatibilities with any of the MacBook’s devices in its report, they probably won’t work.

Windows 8 Upgrade Assistant Report

After installing, Windows 8 will show various devices in the Devices list indicating, there are no drivers available. Other’s simply won’t be detected at all, e.g. Windows8 won’t be able to detect the MacBook Pro’s WiFi at all. Function key, keyboard backlight won’t work and the graphics chipset might reset the screen resolution between the MacBook’s native resolution and something about 800×600 from time to time.

Where to get the Windows 8 drivers for my MacBook Pro?

To solve the driver issues, you simply start the Boot Camp Assistant from your Mac OS and follow the instructions until you find yourself faced with the following dialog.

Boot Camp Assistant Task

Chose Download the latest Windows support software from Apple and continue. In the following step follow the on screen instructions either burning a DVD/CD or copying the files to a USB drive or any folder accessible from Windows (don’t drop the files to the Mac OS’s partition, though).

Will it blend work?

Restart Windows 8 and insert the disc, stick and select the setup.exe in the WindowsSupport folder. This will install a whole bunch of drivers.

Boot Camp Windows Drivers

Based on Apple’s Boot Camp 4.0 FAQ , the Windows Support Files contain the following drivers

  • Apple Bluetooth
  • Apple Keyboard Support
  • Apple Remote Driver
  • Apple Trackpad
  • Atheros 802.11 Wireless
  • ATI Graphics
  • Boot Camp control panel for Microsoft Windows
  • Boot Camp System Task Notification item (System Tray)
  • Broadcom Wireless
  • Intel Chipset Software
  • Intel Integrated Graphics
  • iSight Camera
  • Marvel Yukon Ethernet
  • nVidia Graphics
  • Cirrus Logic Audio
  • Realtek Audio
  • SigmaTel Audio
  • Startup Disk control panel for Microsoft Windows

Once installed and the machine restarted, everything seems to work fine, the Windows Bluetooth and Boot Camp icons are shown in the notification area, light sensor, FaceTime camera and sound work perfectly and the graphics card runs smooth like butter.

Windows Networks under Boot Camp

One last word on function keys – they won’t work out of the box. You have to start the Boot Camp Control Panel from the tray and switch to the Keyboard tab.There check the Use all F1, F2… box.

Boot Camp Control Panel

Windows 8 on the MacBook Pro is a great experience even without touch display and retina. Upgrading without checking for the drivers of course was a greenhorn mistake. However, I hoped (yes I know indeed, hope is not a strategy) during the inplace upgrade, Windows will keep the drivers. However, the fact that all drivers still work, clearly shows that the driver architecture from Windows 7 to Windows 8 did not change at all. That’s good as manufacturers do not need to update drivers in a hurry based on a new architecture, but on the other side it shows that there are not that many improvements how Windows deals with the hardware. But again, maybe this is not necessary at all.

Before you upgrade to Windows 8, run a backup! I did so using Acronis True Image 2013. Even without thinking about drivers, I was not sure whether the upgrade process with Boot Camp on the machine will maybe brick my box. Also run a backup of you Mac OS partition using Time Machine.

Said that kids, please bear in mind, that this worked fine on my machine, and might fail on yours. Also there is probably no support from Apple for Boot Camp 4.0 running Windows 8.

DropBox with TrueCrypt on Lion and Windows

After receiving my new MacBook, I wanted to sync a whole set of files between both systems. For convenience, I decided to use DropBox instead of a thumb drive and for security reasons, I decided to use TrueCrypt to encrypt some of my confidential data within the DropBox folders.

Using a TrueCrypt container within DropBox is quite convenient as I am syncing my DropBox folders with various machines (e.g. at work). However, I do not want to access these file there nor do I want that an admin might check out my “oooh so secret” files (not saying they would, though).

DroppBox with TrueCrypt on Lion and Windows

With my rusty Mac OS kung-fu, I had to install TrueCrypt first. Of course, this failed and being the first app I did install on Lion, this was somewhat demotivating. Before you have install a version from MACFuse. It seems that the official version is not up to date, however, there are rumors you might use the latest version provided at Tuxera.com.

Once MACFuse and TrueCrypt are set up and the machine is rebooted, create a TrueCrypt container within DropBox. When creating on OS X Lion, you might want choose FAT for the containers file system so you can mount it on the Windows system as well. However, any change within this container will synchronize the container as a whole. Not being very efficient if this is a 256 MB file, it seems that one can turn of the timestamp of the TrueCrypt container to avoid syncing it. This will prevent that the container gets synced after files within the container are changes, however, the itself files are still updated. To turn it of, open TrueCrypt and select Settings / Preferences… chose the Security tab and uncheck the Preserve modifications timestamp of file container checkbox.

TrueCrypt Settings on OS X Lion

Of course, the same has to be done on your Windows system.

TrueCrypt Settings on Windows 7

Once both settings are applied, only the initial sync of the container will take some time. Thereafter, only the files within the container are updated. for me this seems to be a quite good solution to keep my boxes in sync and to avoid rubbernecks seeking through my private stuff. The setup is done quite easily, only the hassle with MACFuse was quite annoying.

iScrobble

 

Already scrobbled today?

“Scrobbling a song means that when you listen to it, the name of the song is sent to Last.fm and added to your music profile.”

I just downloaded iScrobble and added a LastFM widget to this page. Unfortunately, the widget does not fit 100%. So, I have to modify the page layout a bit soon.

The tool does permanently upload your played songs (including syncing the iPod playlist). Welcome to the new world. Big brother – and the media industry is watching what you are listening. However, LastFM provides some great possibilities so search for similar music and artists.

iScrobble