Sunday, June 27, 2010

Ultimate Windows Mac - Part 2

This is Part 2 in a series on configure a MacBook for Windows power users.

When I left off in Part 1 I was debating on which SSD to use. I decided on a OCZ Vertex 2 after reading about some issues the RealSSD's were having. I also purchased an MCE ObtiBay. So let's get to installing these parts. UPDATE: I'm having issues getting full performance from the Vertex 2 using Windows (seems to be limited to SATA I speeds). You may be better offer getting a lower ended SSD if your hardware/software combo is the bottle neck. More info will come as I work my way through the issue.

I'm not going to go into great detail on installing the hardware since others have already done it way better then I could. I left the OEM drive where it is and just installed the new SSD using the ObtiBay. The instructions from MCE where excellent. If you still need help with installation Other World Computing is a great resource.

Now that the drive is installed it's time to install Windows. I'll be installing Windows 7 Enterprise N 64bit edition. Since I'm not installing Windows to the same hard drive as OS X, I didn't run Boot Camp to prepare the drive. Instead I just booted from the Windows 7 DVD and installed Windows to the second hard drive (in my case the SSD one since I'll primarily being using Windows). Be careful which drive you install to. If you're paranoid then remove the OEM disk with OS X installed on it before beginning the Windows install.

Once Windows is installed you need to install the Boot Camp software. Put in your OS X installation disc and run setup. If you get the following error "Boot Camp x64 is unsupported on this computer model" which may happen if you use a retail disk of OS X, open a Command Prompt in Windows as Administrator and type the following:
cd /d D:
cd "Boot Camp\Drivers\Apple"

Run through the installer and most if not all your MacBook hardware should have the correct drivers installed. In my case the Light Sensor gives me a "This device cannot start" error but considering I'll have my laptop hooked up to an external monitor and keyboard 90% of the time I didn't bother fixing it. I'll make an update if I ever spend time looking for a solution.

The next step I do is to configure the keyboard so it's uses a PC style keyboard layout. There are a couple solutions but Sharp Keys is my favorite.

Map the keys as follows. Older MacBooks have an "Enter" to the left of the directional errors. New MacBooks have a "Right Alt/Option" key. The screen shot and direction handle both versions.
Num: Enter (E0_1C)             = Special: Right Ctrl (E0_1D
Special: Left Alt (00_38)      = Special: Left Windows (E0_5B)
Special: Left Windows (E0_5B)  = Special: Left Alt (00_38)
Special: Right Alt (E0_38)     = Special: Right Ctrl (E0_1D)
Special: Right Windows (E0_5C) = Special: Right Alt (E0_38)

This works great if you don't plan to use an external PC style keyboard. I use a Microsoft Natural Ergonic Keyboard 4000 at home and at work. These key mappings will cause the external keyboard to work different so I need to be able to toggle back and forth. Unfortunately Windows needs to be restarted (or at least logged off) for keyboard mapping changes to take effect. The best solution I came up with is to script this. Our custom keyboard mapping is stored in the registry so I've created two registry export files and 2 batch files to either Enable or Disable the custom mapping. As soon as I log into Windows I run the batch file I need and it will immediately log me off and then I'll log back in and the keyboard will be in the configuration I need. I also add 3 registry settings for the mouse. I like the MacBook Pro's trackpad to be "slower" then my external mouse and I also find scrolling 1 line at a time is better with the trackpad versus 3 lines for the external mouse.

You can create the 6 files you need as follows or download them from here.

MacKeyboard-Enable.reg :
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,06,00,00,00,1d,e0,1c,e0,5b,e0,38,00,\

MacKeyboard-Disable.reg :
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=-

MacMouse-Enable.reg :
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]

[HKEY_CURRENT_USER\Control Panel\Mouse]

MacMouse-Disable.reg :
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop]

[HKEY_CURRENT_USER\Control Panel\Mouse]

~MacHardware-Enable.bat (I use the tilde to force the file to the top in the list)
REGEDIT.EXE  /S  "MacKeyboard-Enable.reg"
REGEDIT.EXE  /S  "MacMouse-Enable.reg"
shutdown -l

REGEDIT.EXE  /S  "MacKeyboard-Disable.reg"
REGEDIT.EXE  /S  "MacMouse-Disable.reg"
shutdown -l

The next part is specific to my dual hard drive configuration and it's your call if you want to do it. Since I didn't buy a monster sized SSD I want to store any data that is large and relatively static on the regular hard drive we're running OS X off of. The first step is to boot into OS X and use BootCamp assistant to partition your hard drive. Of the 320GB on the hard drive my MacBook came with I gave OS X 60GB and I'll use the other 260GB as a "data" partition. After partitioning with BootCamp choose to "not install windows" at this time and then boot back into Windows to format the drive using NTFS. The drive should now be available as drive D: (drive letter may vary but I'll assume it's D for the rest of this article). You could choose to move the entire "User" folder to the new drive. Since this would include various application temp and setting folders that may be altered often and may benefit from being on an SSD I opted to just move the individual "Documents", "Downloads", "Music", "Pictures", and "Videos" folders.

You could do it the "easy way" built into Windows 7 but I chose a more transparent way since some Windows programs don't seem to default to the correct folder when using the "easy way". I'm going to use the command line program MKLINK to create a "symlink" similar to what Unix has had for ever.

First I create individual "Documents", "Downloads", "Music", "Pictures", and "Videos" folders on the D drive. If you have a lot of data already in these folders on the C drive then use this guide to move the data. My folders are still pretty much empty so I just deleted the folders on the C drive and then opened a command prompt and typed the following from your User Profile directory (ex. C:\Users\CDEUTSCH):
MKLINK /J Downloads D:\Downloads
MKLINK /J Documents D:\Documents
MKLINK /J Music D:\Music
MKLINK /J Pictures D:\Pictures
MKLINK /J Videos D:\Videos

Another optional step is to purchase and install MacDrive if you want the ability to write to the partition with OS X on it.

On my first MacBook Pro I tired to "share iTunes" between OS X and Windows. I stored the files in the default Music folder in OS X, then used MacDrive on Windows to read and write to this location. You can have iTunes open an alternative iTunes library by holding the "Shift" key while opening iTunes. This worked Ok, except iTunes always update the file paths every time you switched from Windows to OS X. This process took way too long sometimes, so after Windows 7 came out I moved iTunes to my Windows partition and now only use iTunes under Windows. I currently mostly use OS X for MonoTouch iPhone development and for casual web browsing. If you're into hooking up your laptop to your TV I highly recommend Boxee, Remote Buddy, and Hulu Desktop (I use a dedicated MacMini for this instead of my laptop). Another thing OS X is great at is backing up your Windows partition. Winclone is excellent but I believe it only works for GPT formated drives. So unless you're running Windows on the same drive as OS X I would find another program for doing a bare metal backup. I may explore this more in a future blog post.