libdb2.so.1: cannot open shared object file

I got this error starting a ruby application:

An .so is a Linux library, equivalent to a .dll on Windows or a .dylib on Mac. Note that there are two different libraries mentioned. ibm_db.so is present, while libdb2.so.1 is missing.

You can verify the dependencies using the ldd command:

For me, the issue was caused by a missing IBM Data Server Driver directory. IBM_DB_LIB was pointing to a non-existent directory:

Reinstalling the Data Server Driver restored the libdb2.so.1 and eliminated the error.

(If you run into this issue with different libraries, you will likely need to examine your LD_LIBRARY_PATH environment variable and use the ldconfig command to reload any changes.)

How to run and install IPMIView on Mac

Softlayer cloud uses IPMIView for direct console access to bare metal hardware. SuperMicro makes a Mac version of IPMIView available for download.

Bizarrely, SuperMicro doesn’t appear to have ever tested it, because double-clicking on the downloaded IPMIView20 application doesn’t do anything. This is because someone forgot to set the execute permission on the installer.

Supposing it’s in your downloads folder, open up Terminal and run the following commands:

This will open up the installer for you. Once it’s installed, it will show up in your Launchpad like a normal application.

Launchpad

Persistent SSH sessions with screen

Do you ever need to kick off a long-running command while SSHed to a server, but be able to disconnect and reconnect at will? You can do this with screen.

Before doing anything, start a screen session:

When you’re ready to put your work on hold, detach the screen:

If you have a long-running command running, you can detach that screen from a different shell session by specifying the process id:

You can now disconnect from the server safely.

When you reconnect, you can also reconnect to your screen session:

 

How to rename a file in a File upload dialog on Mac

Windows users will scoff at this, but renaming a file in a File Upload dialog box on Mac is a surprisingly obscure action. Renaming is not available in the context menu, nor does the usual shortcut work.

Screenshot 2014-03-24 18.01.26To rename a file in a regular Finder window, you can select it and hit the Enter key. However, you can’t do this in a File Upload dialog as the Enter key has a different meaning.

To rename a file, select it, hit Cmd+I, open up the Name & Extension pane, and change the name.

Windows to Mac: Keyboard shortcuts

In December, I got a Macbook Air that I’m now using as a primary development machine. Before that, I was developing on a Windows 7 machine with heavy reliance on Git bash and Cygwin, and using Linux on the server. I’ve used Linux as a primary desktop at times, but found both dual-boot and VMs too much of a hassle.

I’m enjoying the Mac, but one of the biggest adjustments is keyboard shortcuts.

Here are some shortcuts that are specific to the Mac Terminal (and Terminal alternatives like iTerm 2):

Mac Mac Terminal Windows Action
Cmd+Left Arrow Ctrl+A Home Go to start of line
Cmd+Right Arrow Ctrl+E End Go to end of line
Shift+Cmd+Left Arrow Shift+Home Select to start of line
Shift+Cmd+Right Arrow Shift+End Select to end of line
Ctrl+K Clear line after cursor
Ctrl+U Clear line before cursor

Some general shortcuts:

Mac Windows Action
Cmd+Down Arrow PageDn Go one page down
Cmd+Up Arrow PageUp Go one page up
Cmd+Space Windows key Start menu/Spotlight
Cmd+Opt+Esc Ctrl+Shift+Esc Open Task Manager
Cmd+Delete Delete Delete selected files
Cmd+Delete Delete Delete character in front of the cursor
Cmd+R F5 Reload current webpage
Cmd+Shift+3 Save screenshot to desktop/Dropbox
Cmd+Ctrl+Shift+3 PrtScr Copy screenshot to clipboard
Cmd+Shift+4 Save screenshot of an area of screen to desktop/Dropbox
Cmd+Ctrl+Shift+4 PrtScr (SnagIt) Copy screenshot of an area of screen to clipboard

Of course, there are many more shortcuts.

libdb2.so.1: cannot open shared object file: No such file or directory – … ibm_db.so

Got this error while deploying a Rails app on Nginx:

This means that the ibm_db adapter is installed, but it can’t find the DB2 libraries. The issue is that IBM_DB_HOME and some other environment variables are not set.

The best solution is to make sure all users have db2profile loaded. Edit /etc/profile and add:

You should now reload your profile (. /etc/profile) and restart Nginx.

This assumes that you already have IBM Data Server Driver installed under /opt/dsdriver.

Linux command of the day: banner

banner can be a useful command for setting login and welcome messages (e.g via /etc/profile).

The Mac implementation is less useful than the GNU/Linux one.