Mac: Run Script before or after Wake from Sleep

I have a few scripts that I want want my macbook to run just before I put it to sleep (by simply closing the lid).

To achive this I did the following:

  1. I installed sleepwatcher via brew
    brew install sleepwatcher
  2. Then I copied the launchd files to the ~/Library/LauchAgents directory
    cp /usr/local/Cellar/sleepwatcher/2.2/de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist ~/Library/LaunchAgents
  3. I restarted my Macbook and created the ~/.sleep script which contains the commands that will run before sleep.. (You could also create a ~/.wakeup script that runs when the mac wakes up.)

Source: EchoDitto Labs, Stack Overflow

Dockless hides apps from the dock

I’ve been using a small app called dockless. Dockless hides the icon from the dock…that’s all. But it does it great and it’s free.

Dockless is a little app that does what some people have always wanted – remove certain applications from their dock. Dock real estate can become precious, and some apps don’t make a whole lot of sense sitting there. That’s where Dockless comes in. With Dockless, any OS X application can be made to show in the Dock or not.

Download dockless here

DavMail is a Exchange to IMAP CalDav proxy

Snow Leopard and Mac OS X Lion both have built in support for Exchange 2007 and 2010.

But what do you do if your company is running Exchange 2003 or if you want to run IMAP (And your company only permits a “Outlook Anyware”-type setup, IMAP over HTTPS).

Well you can either stick to running the Outlook Web Access, which in Exchange 2010 is kind of nice, or you can install a program called DavMail. DavMail acts as a proxy between your computer and the corporate Exchange server.

Some really nice features in DavMail:

  • It’s cross-platform. You can run it on your Mac, Windows och Linux machine.
  • You can run it on a server or locally on your client-computer.

How to install Huawei e173 on Mac OS Lion

I live in Sweden and bought a Huawei e173 from the Swedish operator Telia. The only problem is that the 3G modem came with drivers and software for Snow Leopard (Mac OS X 10.6).

To start off, I installed the modem on a windows machine and disabled the PIN-code on the simcard. I personally get quite annoyed when I have to enter a PIN-code everyone I connect a 3G modem..

Next, I downloaded the drivers on my own from mobinil.com, installed them and configured the modem with the following settings:

Dial: *99#

Vendor:Generic

Model: GPRS (GSM/3G)

APN: online.telia.se

Note that the APN is different on every carrier. Just Google it…

How to force TotalTerminal to always display on top of the dock

I have been using TotalTerminal for a while now. But since the latest 1.1.1 the visor is displayed under the dock. (I have my dock on the left side of my screen) This is both annoying and renders the TotalTerminal useless.

This is all due to a bug fix in 1.1.1. There is a way to fix this issue.

Open a new terminal.app window and enter the following line:

defaults write com.apple.Terminal TotalTerminalVisorWindowOnHighLevel -bool YES 

Restart Terminal.app with TotalTerminal.

The TotalTerminal visor is now shown on top of the dock.

Source: GetSatisfaction

Ejecting USB drives takes two tries with CleanMyMac

Some time ago I found that when I tried to eject any external drives  from my Mac it always failed on the first try, but succeeded on the second.

This is very annoying, as I’m using alfred to speed up pretty much every command on my Mac. So basically I had to type “eje” (the start of the Eject command) two times instead of one..

It turned out that CleanMyMac checked the drives as they where being unmounted, thereby locking the drive. So I disabled these settings and voila, everything worked.