Category Archives: OS X

OS X: disable Mission Control on top edge

In El Capitan Apple introduced a feature which opens Mission Cotrol as soon as you drag a window to the top edge of the screen. That is annoying at least to me. Therefore here is a possible fix:

Disable:

defaults write com.apple.dock mcx-expose-disabled -bool TRUE && killall Dock

Enable:

defaults delete com.apple.dock mcx-expose-disabled && killall Dock

Full restore from Time Capsule with account-authentication

 

This week the people at Apple released their new OS X-Version called "Lion" (10.7). Some interesting new highlights in terms of UI, backup and encryption were announced. I was curious and gave it a shot.

To be on the safe side I did a full backup with Apple's rsync-based Time Machine-software on my Time Capsule backup device. This way, I expected to be able to do a full system restore of a pre-upgrade-state in case something goes south.

Mission Control unfortunately is a pain

After trying Lion for a very short while, I discovered that quite many of my favorite tools wouldn't work as they did in Snow Leopard. Examples are Quicksilver, MacBiff, PathFinder and GeekTool. I suppose that most of these tools will get an update sooner than later so I would've been able to live with that.

Yet, one thing really is such a bummer that I'm not going to use Lion in the near future: Mission Control basically killed Spaces, Exposé and the handy "show all windows" functions. I rely on these in my daily work by using "hot corners" and I don't want to be forced or patronized to change my well working processes. I guess I'm not the only nerd to consider this a step backwards, so I'm counting on some witty developers to revive projects like Desktop Manager or Virtue in order to rebuild the Snow Leopard-ish window management behavior.

Starting the restore

Long story short I now wanted to do a full restore of my Snow Leopard setup. Considering myself security concerned, I gave separate accounts on my Time Capsule to all machines which do a backup there. Then I booted my Snow Leopard-DVD and chose the option to do a full restore from a Time Machine-backup.

The restore helper program displayed the according backup and even accepted my auth-data. Yet, I couldn't start the backup. I tried the same from a different Mac and another backup: same issue.

I figured it must have something to do with the user accounts on the Time Capsule as I was able to restore a Mac back in the days when I had only one machine. I changed the file sharing-setting in AirPort Utility so that the Backups were just secured "With Time Capsule password". Having a look at the directory structure on the Time Capsule, I saw that the backups are not stored in the actual root directory. Due to using user accounts, there was now a structure of /Users/machineName.

Bug found and worked around

I suspected there might be a bug in the restore software, expecting backups always in the root directory of the Time Capsule drive. I moved the according sparse image of my machine to the root of the Time Capsule and tried the restore again. It worked!

The result is that the "Restore System from Backup" functionality on the DVD can't handle separate user accounts on a Time Capsule. Apple, you should be embarrassed about that, especially for not documenting and not fixing this.

Anyway, after the successful restore I moved back the sparse file and reactivated the Time Capsule-accounts to keep my security conscience calm. After that, all backups are working as they did before.

Fresh install of OpenWrt Backfire from Mac OS X 10.6 by tftp

 

This article documents flashing OpenWrt Backfire on Linksys WRT54g v2 and on Asus WL-500g Deluxe and Premium. It uses OS X's built-in tftp to transmit the firmware to the router while it's in recovery mode. Recovery mode is active only for a few seconds in the beginning of the router's boot process.

Firmware retrieval

As of today, the most recent and solid firmware version is Backfire 10.03.1-rc4. The according download links are the following:

Network configuration of OS X

Disregarding the router's network setup before the following installation process, during rescue mode it will always fall back to 192.168.1.1/24. Therefore, if you do not already use a 192.168.1.0/24 subnet, you will have to to add a virtual interface to your Mac.

Therefore, in "System Preferences" open "Network" and follow these steps:

  • Click the little "plus"-sign in the lower left corner
  • Choose "Ethernet" and some random name for the interface
  • Click "Create"
  • Then, from the "Configure IPv4"-dropdown, choose "manually" as network setup
  • Enter "192.168.1.2" as "IP Address" and "255.255.255.0" as "Subnet Mask"
  • Confirm with "Apply" in the lower right corner

Now, you have an addition virtual interface on your shiny OS X-system by which you can feed the router with the new firmware.

Transmitting the firmware

Luckily, OS X comes with the tftp command, so there is no further setup on that part. Simply open a terminal window and type (or copy'n paste):

tftp 192.168.1.1
binary
rexmt 1
timeout 60
trace
Flashing the Linksys WRT54g

Now, type the following line but do not execute yet:

put 

Just before hitting "Enter", unplug and replug the router's power cable. After only a few seconds you should get a lot of output like this:

[...]
sent DATA 
received ACK 
[...]
Flashing the Asus WL-500g Deluxe/Premium

With the Asus routers, the process is basically the same. The difference is that while plugging in the router's power, the reset button has to be pressed. Also important to notice is that Asus routers keep their previous network setup in recovery mode, i.e. you don't have to adjust your network setup to 192.168.1.1. Yet, after flashing, the Asus devices will turn to 192.168.1.1.

First contact with the new system

The above output confirms the successful transmission of your firmware. If nothing went wrong, you will be able to reach your router by web access on http://192.168.1.1. Also, you can already use telnet to gain shell access:

telnet 192.168.1.1

Beware that in case you upgrade from a previous OpenWrt setup, the router might have recovered some of the old setting and therefore starts with the previous networking setup.

Now, you may follow the hints on http://wiki.openwrt.org/doc/howto/basic.config about basic configuration immedately after flashing OpenWrt.

List Disks in OS X

A simple but useful command line to find out about hardware names of connected disks in OS X is:

diskutil list

Wifi Analysis in OS X

Aside from all those OS X wifi scanners originating from the Linux world, OS X comes with its own basic tool called airport. For quick access do the following:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/bin/airport

Now, example usages can be:

airport en1 scan

or

airport en1 sniff 6 

Quick Screenshot in OS X

A very quick screenshot is taken and saved to your Desktop by the following keyboard shortcut:

CMD+Shift+3

Sleep/Wake Events in OS X

*[Macports]: http://www.macports.org/

In case you wish for certain events to take place on sleep or wake of you Mac, the software sleepwatcher is your friend. You can install it from Macports with the following line:

sudo port install sleepwatcher

To launch it on system startup, do this:

sudo port load sleepwatcher

If e.g. you want to show a login window on wakeup, create an executable file called ~/.sleep with the following contents:

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

Update on 10/10/2015:
The latter doesn't work anymore. You'd need your own binary accessing the locking feature of Apple's Keychain. The source code is like this:

\#import <objc/runtime.h>
\#import <Foundation/Foundation.h>

int main () {
    NSBundle *bundle = [NSBundle bundleWithPath:@"/Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.menu"];

    Class principalClass = [bundle principalClass];

    id instance = [[principalClass alloc] init];

    [instance performSelector:@selector(_lockScreenMenuHit:) withObject:nil];

    return 0;
}

Save this as =lockscreen-main.m= and compile it with

clang -framework Foundation lockscreen-main.m -o lockscreen

Disable Apple Ping

With iTunes 10 Apple introduced a new annoyance: Ping. It's a new music-centric social network, for which at least I don't have a use for. Therefore, the following line helped me disabling it:

defaults write com.apple.iTunes hide-ping-dropdown -bool TRUE
defaults write com.apple.iTunes disablePingSidebar 1 

Flush OS X’s DNS Cache

If you need to flush a Mac's DNS cache, the following line will be helpful:

sudo dnscacheutil -flushcache

Reset a Mac’s PRAM and NVRAM

In case you need to reset a Mac's PRAM and NVRAM, do the following steps:

  1. Shut down the computer.
  2. Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
  3. Turn on the computer.
  4. Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
  5. Hold the keys down until the computer restarts and you hear the startup sound for the second time. 6. Release the keys.