Sharing Applications Between Mac OS X and Windows

Mac OS X, Windows No Comments

In my previous post, Setup Mac OS X 10.8 Mountain Lion, Windows 7 Boot Camp, and Shared FAT32 Partition, I decided to use Mac OS X as much as possible and in addition to Windows 7. It would be nice if I could use the same applications (or equivalents) on both operating systems. And it would be great if those apps made use of the same data whether running on Mac OS X or Windows 7. Effectively, I would like to share my apps between Mac OS X and Windows 7.

My methods for “App Sharing” in order of preference are:

  1. If both the Mac OS X and Windows 7 application versions use the same data format, then store that application data in a shared FAT32 partition (I had corruption issues with exFAT). If you don’t have a shared partition, you can use a private network share or even a cloud-based drive like DropBox (which introduces some security concerns).
    • My favorite secured information storage apps, Keepass and Truecrypt, run under both Mac OS X and Windows 7 and use the same data files on the shared partition. (Note: I saw some comments that using a large Truecrypt file with Dropbox may have issues such as sync not working 100% or not working in a timely manner.)
    • To a lesser extent, iTunes on Mac OS X and Windows 7 can use the same music and video files on the shared partition. Just run each iTunes and use the Mac OS X “File->Add to Library” or Windows 7 “File->Add Folder to Library” menu option. If you wish to sync your iPod, iPhone, or iPad to either the Mac OS X or Windows 7 iTunes, make sure they share the same library identifier; see my post, Sync an iPod Touch to Two Computers, for instructions.
  2. If the Mac OS X and Windows 7 application versions don’t use the same data format, then they might support cloud sync’ing. My primary concern with the cloud is security, because a copy of my information will be accessible on the Internet and stored in a hard drive belonging to a company which might not always have my privacy as its top priority. It is a lot less secure than just having a local copy on my hard drive. To mitigate this, I will remove all sensitive information before using the cloud.
    • The browser I use, Chrome, supports sync’ing bookmarks, tabs and extensions to/from Google. It’s as simple as going to Settings, “Signing in to Chrome” (specifically, providing your Google account’s username and password), and clicking on “OK, sync everything”. If you sign in from multiple machines, the bookmarks will be merged. To see tabs opened on other machines, create a new blank tab and click on the “Other devices” link at the bottom.
    • The latest version of my favorite note taking application, Evernote, runs on both Mac OS X and Windows and supports cloud sync’ing. For sensitive info, the latest Evernote offers an option to password-protect-encrypt a note. I am using an old, non-cloud-enabled version 2.1 of Evernote for Windows and plan to upgrade to the latest cloud-enabled versions on Mac OS X and Windows 7.
    • My contact information and notes are stored in a Personal Storage Table (PST) file used by Microsoft Outlook for Windows. I found that Outlook 2003, 2007, and 2010 for Windows used the same PST file without any issues. And Outlook 2010 for Windows can cloud sync directly to Google Contacts and Notes (Google provides sync tools for Outlook for Windows). Unfortunately, Outlook 2011 for Mac OS X does not use PST and does not support cloud sync’ing directly to Google. However, Outlook 2011 for Mac OS X can sync to the Mac OS X Mountain Lion’s Contacts (new name for Address Book) and Notes applications, and the Contacts and Notes application can cloud sync directly to Google. (If you don’t want to use Google, there is a way to use iCloud instead for the same purpose.)
    • If I wish to sync my contacts and notes in Outlook to an iPhone or Android phone, the above method of cloud-sync’ing to Google Contacts and Notes will help. I can sync contacts and notes on the iPhone and Android phone directly to/from Google. Alternatively, for iPhone, I can use iTunes sync with Outlook on Windows, or iTunes sync with Contacts and Notes on Mac OS X.
  3. If the Mac OS X and Windows 7 application versions don’t use the same data format and don’t support cloud sync’ing, they will usually provide an export/import migration path between the Mac OS X and Windows 7 application versions. In this case, I would just migrate to using the application solely on Mac OS X. In the future, if I need to, I can migrate back to Windows 7.
    • My expense tracking application, Quicken, supports migrating data from the Windows version to Mac OS X version. Because Quicken for Mac OS X may not have the same set of features as for Windows, you will want to research whether the Mac OS X version will fit your needs. I plan to upgrade from Quicken 2003 for Windows to Quicken Essentials 2010 for Mac OS X.

Moving from Evernote 2.1 for Windows to Evernote 4.5 for Windows and Evernote 3.3 for Mac OS X

Evernote supports export/import but there was an export data format change between Evernote 2.1 and the latest Evernote versions. I found a forum post, New user help-importing Evernote 2.0 files into Evernote 4.1, which indicated that we need to use Evernote 3.1 for Windows to import the old Evernote 2.1 format and then export to the new data format. Actually, I found that Evernote 3.1 was cloud-enabled, so there was no need to export because the imported 2.1 notes were sync’ed directly to the cloud.

Here’s how I migrated from Evernote 2.1 to the latest version:

  1. Run Evernote 2.1 for Windows. There is no need to do an export because the exported “ENExport.enx” file won’t be usable.
  2. Look at the bottom status bar to see the total number of notes. It will say something like “Notes: 272” or “Notes: 15 of 272”.
  3. Quit Evernote 2.1. Do not uninstall it yet because we may need to use it later to verify that all notes were migrated.
  4. Install Evernote 3.1 for Windows (it will co-exist fine with Evernote 2.1). I was able to download a version of Evernote 3.1 from FileHippo.
  5. Run Evernote 3.1 and sign-in. You will need to register for an Evernote account, if you don’t already have one, to use Evernote. Even if you plan to only use locally stored notes, and not the cloud-sync’ed notes, you still need to have an account.
  6. Go to menu File->Import->Evernote 2.x Databases… and select your 2.1 database file “EverNote.enb”, which is usually located under the Evernote 2.1 install directory; for example: “C:\Program Files\Evernote\Evernote 2”. (Note: There is a menu option File->Import->Evernote Export Files… but it will ask for the new .enex export file which we don’t have.)
  7. The import will occur. At the end, I got a warning message saying that some of my imported notes contained “Premium File Attachments” which are not supported under the free account. I didn’t think I was attaching any files that were not in the list of supported free file attachment types (also listed in the warning dialog), so I clicked on the “Restricted Import” button. “Restricted Import” appears to import all notes except the ones that have the premium file attachments.
  8. Once the import completed, a “Data import successful” dialog appeared and asked if I wanted to “Place all imported notes into a synchronized notebook now?” I answered Yes.
  9. Back in the main Evernote window, in the left navigation pane, I noticed a new notebook called “EverNote” under the Notebooks section. There is a sync icon before the name, which I guess means it is synchronized to the cloud. After the name is the number of notes in parenthesis; in my case, it shows as “Evernote (271)”.
  10. Since I had 272 notes in Evernote 2.1, it looks like one note was not imported, probably the one with the premium file attachment. Now to track down the missing note.
    • I checked the log file by going to menu Tools->Options->General->Open Log folder and opening the “AppLog_[date].txt” file. (There is a “SyncLog_[date].txt” but it just contains logs from the cloud sync function, not the import function.) I scrolled to the bottom of the AppLog and saw this message, “272 notes successfully imported”. There wasn’t any message about which note was not imported. Darn.
    • Looks like I have to do a brute-force comparison with the old Evernote 2.1 notes. Thankfully, I filed my notes under many manual categories so it really helped to facilitate the comparison. On Evernote 3.1, in the left navigation pane, I opened up Tags->Manual categories. I started Evernote 2.1 and opened its Manual Categories. Then I checked the count of notes in each category to find a mismatch in the number. I was able to locate the missing note in Evernote 2.1. Strangely, it only had an embedded image and I was able to copy and paste it into Evernote 3.1 successfully. The count of notes in Evernote 3.1 went to 272. Problem solved.
  11. I noticed that all my imported notes had text saying “(needs sync)” in its title. Looks like I needed to synchronize the imported data to the cloud.
    • I was concerned about the 60MB/month upload limit on a free Evernote account. To see the size of my database, I went to menu Tools->Account Properties and Database tab. My notes are mostly text so it was only 2.4MB in size. I think if your data is larger than 60MB, you might need to sign up for the premium account.
    • In that same Account Properties dialog, under the Account Usage tab, I found how much of the 60MB/month limit I had already used; it said “”0.5MB out of 60 MB used” so far. You can also get to this tab by clicking on the “Current Monthly Usage” in the top ribbon-like bar.
    • I clicked the Synchronize button at the top-left to sync against the cloud. The progress was reported in the bottom status bar to the right and looked like “Updating server database, 55% done”. Strangely, “Updating server database” went to 100% about 3-4 times, interspersed with “Updating client database…” progress messages.
    • Once the sync was complete (no more status updates), my notes no longer had the “(needs sync)” text in the title. I double-checked the monthly usage and it still said “0.5MB out of 60 MB used”, instead of the 2.9MB that I expected. Oh well.
  12. Exit Evernote 3.1. If you exit with unsynchronized notes (even notes in the trash), you will see a warning dialog. Just cancel the exit and do the sync and/or empty the trash.
  13. Uninstall Evernote 3.1 and re-install the latest Evernote 4.5 for Windows. You can also install the latest Evernote 3.3 for Mac OS X (from the Mac App Store).
  14. Once you sign-in to Evernote, the notes will sync down from the cloud. You can see the sync progress in the status bar; under Evernote 4.5, to show the status bar, go to menu View->Show status bar.

Sync’ing Contacts and Notes between Outlook 2010 for Windows and Outlook 2011 for Mac OS X

As described above, sync’ing contacts and notes between the Windows and Mac OS X versions of Outlook is complex, involving intermediate applications. I will do a separate post later about how to do the Outlook sync between Windows and Mac OS X.

Moving from Quicken 2003 for Windows to Quicken Essentials 2010 for Mac OS X

Because I use Intuit Quicken as a glorified expense tracking application where I manually input all the expenses and run summary reports, I was fine with using the very old Quicken 2003 for Windows. I used one Quicken file for each year and in the file, I used one account for each month. So, for each year, I could see the trend of how much I spent monthly (accounts listing) and how much I spent per category (itemized report).

From the reviews complaining that Quicken Essentials for Mac OS X is a glorified checkbook with transaction downloads from banks, it looks to be more than what I need because I didn’t want to download transactions from a bank. I don’t plan to provide my bank’s login credentials to anyone! After testing Quicken Essentials, I found that it was fine for my needs: manual expense input works great and the pre-defined summary, trend, and itemized category reports provided the info I wanted.

Unfortunately, to migrate from Quicken 2003 for Windows to Quicken Essentials for Mac OS X, I needed to upgrade to Quicken 2004 for Windows as an intermediate step. How do I know this? The Quicken Essentials’ converter tool told me so when I attempted to open a Quicken 2003 file.

Thankfully, Intuit provides a copy of Quicken 2004 free for anyone who needs to upgrade to Quicken 2005 and later from a version earlier than Quicken 2004. To download and install Quicken 2004 Deluxe, do the following:

  1. Browse to Using an Intermediate Version To Convert Older Versions of Quicken.
  2. Expand “Quicken for Microsoft Windows” and click on “Quicken 2004 for Windows” to download it. (Note: If you use Chrome, Chrome may report that the download page contains malware, but this is a false positive. Ignore it and click on the “proceed anyway” link.)
  3. Once downloaded, run “QW04DLX.exe” to install Quicken 2004 Deluxe.

To upgrade your data files from Quicken 2003 to Quicken 2004:

  1. Locate your Quicken 2003 data files (they come in file sets with extensions .QDF, .QEL, .QPH, and .QSD). By default, the data files are located in the Quicken installation directory under “C:\Program Files\Quicken” or “C:\Program Files (x86)\Quicken”, or they could be under the “My Documents\Quicken” or “Documents\Quicken” folder.
  2. Run Quicken 2004, go to File->Open, and select the 2003 .QDF file. Quicken 2004 will show a “Convert your data file” dialog, so confirm it by clicking on the OK button.
  3. Quicken 2004 will save the original 2003 data files under a “Q03Files” sub-directory and generate the updated 2004 data files (file sets using extensions .IDX, .QDF, QEL, .QPH, and .QSD).
  4. Repeat the above to upgrade other 2003 files.

To export the Quicken 2004 files to a format compatible with Quicken Essentials for Mac OS X (and Quicken 2012 for Windows):

  1. The Quicken Essentials install CD comes with a Windows converter program (insert the CD under Windows to access it) and a PowerPC converter program (which can only run in Mac OS X Snow Leopard or earlier) which can be used to convert Quicken 2004 files and later for use by Quicken Essentials.
  2. Because I didn’t have a Mac OS X Snow Leopard or earlier machine, I decided to run the converter under Windows. Instead of using the converter on the CD, I downloaded the latest Windows Quicken_converter.exe from Converting to Quicken Essentials for Mac from Quicken for Windows or MS Money: expand the “Convert your data from Quicken for Windows” section, look for the “Quicken_Converter_Setup.exe” reference, and click on the “you can download the converter here” link. (Note: If you use Chrome, Chrome will display a false malware warning which you can ignore by clicking on the “proceed anyway” link.)
  3. Run the downloaded “Quicken_Converter.exe” to install “Quicken Converter 2012”.
  4. Launch “Quicken Converter”.
  5. Select “I’m transferring data from Quicken for Windows”, click “Get Started”, select “Open a data file located on this computer” and click “Select File”.
  6. Select your Quicken 2004 .QDF file and click “Convert it!” in the confirmation dialog.
  7. Once done, you will be asked to indicate the location to save the transfer file to. Click OK and select a directory. I selected the automatically created “Q12Files” sub-directory.
  8. Click Save and the resulting export .QXF file (and a new updated 2012 .QDF file) will be saved to the selected directory. This .QXF can be imported into Quicken Essentials for Mac OS X or Quicken 2012 for Windows. (I also think that Quicken 2012 for Windows can open the updated .QDF file directly.)
  9. Click “Convert Another” and repeat the above to convert other Quicken 2004 .QDF files.

To import the exported .QXF files into Quicken Essentails for Mac OS X:

  1. Copy the exported .QXF files from Windows to your Mac OS X machine. I suggest using the shared partition or a USB flash drive.
  2. Launch Quicken Essential for Mac OS X.
  3. Click “Create a New Document”, modify the file name (with extension .quickendata), and click Save. Quick Essentials will open with an initial blank setup.
  4. Go to menu “File->Import…” option.
  5. Select an exported .QXF file and click Open. Your data will be imported.
    • Note: If you import data from more than a year ago, you might be concern that the import failed when Quicken Essential shows you an empty register. This is because almost all of the Quicken Essentials pages will filter on the “Last 12 Months” (look for the filter bar at the top). You will want to change that to “All Dates” in order to see entries older than one year.
    • To import another .QXF file, go to menu File->New…, type the new filename (without the .quickendata extension) into “Save As:”, click Save, and repeat the import steps above.
    • Note: Unfortunately, we can only import one .QXF into one Quicken Essentials file. If you attempt to import a second .QXF file, you will get a error message saying that it is not allowed.

Besides selecting “All Dates” to view older entries, I noticed that the accounts listing is sorted alphabetically and there is no way to override that. I had to rename the accounts to re-order the list to match my needs; for example, changing “Jan” to “01 Jan” and “Apr” to “04 Apr” so January will come before April instead of after. I also hid some columns that I didn’t use. Unfortunately, I had to make these changes for each account because there was no way to change things globally.

No Comments

Customize My Own Mac OS X 10.8 Mountain Leopard

Mac OS X 2 Comments

I recently got a new macbook with Mac OS X 10.7 Lion. I did not like some of the useability changes made (more on that below), but thankfully did not experience the slowdown, crashes, or bad battery life that others had reported. I upgraded to Mac OS X 10.8 Mountain Lion in the hope that those useability changes would be improved. My hopes were dashed, but I was determined to create an unholy combination of the old and the new which I will call Mac OS X Mountain Leopard. Grrr… meow.

Here are the tweaks that I made:

  1. Disable natural scrolling. The reverse scroll seems so unnatural to me. Because I will be switching between Mac OS X and Windows often, adapting to natural scrolling would also cause confusion on Windows.
    • To disable natural scrolling, go to System Preferences->Trackpad->Scroll & Zoom, and uncheck the “Scroll direction: natural” box.
  2. Enable tap-click, two-finger-tap-2nd-click and two-finger-tap-drag in addition to the new three-finger-drag. My fingers are trained to do a two-finger tap or drag so I wanted to enable it and use it alternatively with the three-finger-drag. The three-finger drag is still useful for rearranging icons on the dock; whereas, the two-finger-tap-drag would launch the application instead. I was expecting a three-finger scroll inside an application window in addition to the two-finger scroll, but it wasn’t supported.
    • To enable tap-click and two-finger-tap-2nd-click, go to System Preferences->Trackpad->Point & Click, check the “Tap to click” and “Secondary click” with “Click or tap with two fingers” boxes.
    • To enable two-finger-tap-drag, go to System Preferences->Accessibility->Mouse & Trackpad->Trackpad Options…, check the “Enable dragging” box and leave the default “without Drag Lock” selection.
  3. Globally disable application restore. This feature was very confusing and a bit annoying. For example, when I would run the TextEdit application to open up a new document, I would get 3 or 4 of the previously opened documents also and would have to hunt for the new document. I’m sure that others may find this useful but it wasn’t for me.
    • To disable application restore, go to System Preferences->General and check the “Close windows when quitting an application” box.
    • On OS X Lion, this option is labeled “Restore windows when quitting and re-opening apps” and you would uncheck it to disable the application restore.
  4. Change Gatekeeper to allow installation of programs from anywhere, not just only from the Mac App Store. I ran into this issue when attempting to install GNU Emacs, which I had to download separately because it is not in the App Store.
    • To allow installation from anywhere, go to System Preferences->Security & Privacy and select the “Anywhere” option under the “Allow applications downloaded from:” section.
  5. Disable notifications from programs like gfxCardStatus or Game Center. I’m okay with the Notification Center but too many non-critical notifications can train me to ignore all notifications (like ignoring the boy who cried wolf too many times).
    • To disable specific notifications, go to System Preferences->Notifications, select the application, and then uncheck any or all three options: “Show in Notification Center:”, “Badge app icon”, and “Play sound when receiving notifications”.
    • FYI, the “Badge app icon” is a red circle with a number inside that appears on the top-right of the application icon in the dock . The best example is the Mail program showing the number of unread emails.
    • There does not seem to be any option to only display the banner (which appears in the upper-right of the screen briefly and then disappears) without leaving at least the last notification message in the Notifcation Center.
  6. Disable automatic system updates during sleep. I don’t trust automatic updates and want to be asked if I wish to install them or not.
    • To disable automatic updates, go to System Preferences->Software Update and uncheck the “Install system data files and security updates” box.
  7. Turn on indicator lights on the dock to show that an application is running. This was checked already on my macbook (maybe because I upgraded from Snow Leopard and it persisted that setting).
    • To enable indicator lights on the dock, go to System Preferences->Dock and check the “Show indicator lights for open applications” box.
  8. Turn off Auto Correct. I usually make sure to disable automatic correction in programs like Outlook, Mail, and Word because most of the time, the corrections are wrong. I hated having my technical words replaced by common words because the dictionary used didn’t have those words, or having an acronym re-capitalized. On Mac OS X, I noticed that disabling Auto Correct in the applicatons’ Preferences did not stop all auto corrections from occurring. It turns out I have to disable it at the system level also.
    • To disable Auto Correct, go to System Preferences->Language & Text->Text and uncheck the “Use symbol and text substition” and/or “Correct spelling automatically” boxes.
    • I do uncheck the “Use symbol and text substitution” box because when I type a), b), and c), it is annoying when the c) ends up as a copyright symbol.
  9. Make scrollbars visible all the time. Hiding the scroll bars was a bad idea for two reasons. One, I can’t see the vertical scroll bar until I do a two-finger scroll. Hovering over the location of the vertical scroll bar does not show it; but strangely, doing the same for the horizontal scroll bar will show it. Two, the horizontal scroll bar appears, overlaps an item, and prevents selection of that item. For example, when attempting to move a file that is in the last display line of the Finder’s list mode, the horizontal bar will appear and prevent the selection of that file.
    • To make the scrollbars visible all the time, go to System Preferences->General and select the “Always” option for “Show scroll bars:”.
  10. Show Finder status bar. I like the Finder’s bottom status bar because it provides useful info at a glance.
    • To show the Finder status bar, go to the Finder’s View menu and click the “Show Status Bar” option.
  11. Make hard drives visible in Finder’s left-hand navigation pane. I think the reasoning behind hiding the hard drives is to force the usage of the favorites folder to access files. Unfortunately, I organize my files differently than Apple imagines I would, so I do need a way to quickly view the root folder of my hard drive.
    • To make the hard drives visible in Finder, go to Finder’s Preferences menu, Sidebar tab, and check the “Hard disks” box under DEVICES.
  12. Make the ~/Library folder permanently visible in the Finder. I could use Finder’s “Go->Go to folder” menu and input “~/Library”, but that’s slower than just clicking on the Library folder.
    • To make the ~/Library folder permanently visible, launch the Terminal application and run the following command:
      sudo chflags nohidden ~/Library

    Note: If you use Disk Utility’s Repair Permissions function, it will re-hide the ~/Library folder and you would need to do the above again.

The information above was mostly derived from:

2 Comments

Setup Mac OS X 10.8 Mountain Lion, Windows 7 Boot Camp, and Shared FAT32 Partition

Mac OS X 5 Comments

applebootcampI recently got a mid 2012 Macbook Pro 15in laptop. It came with Mac OS X 10.7 Lion which I promptly upgraded to Mac OS X 10.8 Mountain Lion. I then installed Windows 7 Boot Camp on it. I thought I had the perfect setup.

To my dismay, I found that while the Macbook lasted 6 hours or more while running Mac OS X, the Windows 7 lasted at best 3 hours. The reason for the short battery and heat (the laptop got very hot under Windows) was that under Windows, the discrete graphics card was active all the time! The Boot Camp 4.0 drivers for Windows did not support switching graphics between the integrated and discrete video cards, but instead used discrete all the time.

I decided to use Mac OS X as often as I could to take advantage of the battery life and only switch to Windows when I needed to. Under Mac OS X, there is an neat application called gfxCardStatus which allows me to force Mac OS X to use only the integrated graphics card. This is useful because I found that unlikely applications, like Powerpoint, would switch the Mac OS X to use discrete graphics.

Update: Mac OS X 10.10 Yosemite uses a new Core Storage volume manager which does not support merging or re-sizing. The solution is to revert the Core Storage volume back to a plain HFS+ (aka Mac OS Extended) partition before following any of the instructions below. See my followup post on Revert Mac OS X Yosemite Core Storage Back to Mac OS Extended HFS+ for details.

Unfortunately, sharing information between the two operating systems is inconvenient because while Mac OS X can read NTFS, it can’t write to it. And while Windows can read HFS+, it cannot write to it. There is a commercial product called NTFS for Mac that allows Mac OS X to write to NTFS, but some reviews indicated that the NTFS partition might get corrupted. Alternatively, I could use a cloud service like DropBox but I would have to pay for more storage space, there would be duplicated files on both the Mac OS X and Windows partitions, and there would be a dependency on having Internet access to sync those duplicated files. The best solution (free, non-wasteful, and fast) would be to have a shared FAT32 partition which both Mac OS X 10.8 Mountain Lion and Windows 7 can read and write to.

Update: Initially I used an exFAT partition, instead of FAT32. (exFAT is an enhancement of FAT32 that removes the 4GB file size limitation.) However, after copying back my data to the shared exFAT partition and accessing it from both Mac OS X and Windows 7 under VMware, the shared partition got corrupted within a day. I did some research and found that exFAT on Mac OS X often got corrupted and would disappear. Disk Utility was not able to repair the exFAT partition. I decided to reformat the shared partition as FAT32 using Disk Utility with “MS-DOS (FAT)” format; I can live with the 4GB file size limit, but I can’t live with corrupted data. FAT32 is older (less buggy and more reliable) and uses two file allocation tables (while exFAT uses just one) so it should be more recoverable. I’ve updated this post to refer to FAT32, instead of exFAT.

To create the shared FAT32 partition would require me to re-size the existing partitions. The Mac OS X Disk Utility supports re-sizing the Mac OS X’s HFS+ partition without destroying its contents. Under Windows 7, there are 3rd party tools to re-size the NTFS partition but success was not guaranteed and there was a chance that the Windows Boot Camp partition might become unbootable.

Because I also had an issue with running the Windows 7 Boot Camp under VMware 4 and 5 (I couldn’t figure out why), I decided to start from scratch with a new Boot Camp. After backing up the data on Windows 7, I ran the Boot Camp Assistant to delete the existing Boot Camp partition.

Maximum of Four Partitions

My original Mac OS X Lion came with 3 partitions on the hard drive using the GUID Partition Table (GPT) schema, which we can see by running “diskutil list” under the Terminal command line:


The Extensible Firmware Interface (EFI) partition contains the boot software, the Macintosh HD partition contains the Mac OS X 10.8 Mountain Lion, and the Recovery HD partition contains the Mac OS X Lion Recovery.

Windows 7 uses Master Boot Record (MBR) which allows a maximum of 4 primary partitions (or 3 primary and 1 extended partitions) that Windows 7 can be installed on. Because Boot Camp requires that Windows be the last partition, we have an issue because adding a Boot Camp and a shared partition will result in 5 partitions, rendering the last partition as uninstallable by Windows 7. How do I know? I attempted it and ended up with the resulting Windows 7 install screen to the right. Clicking on Show Details informed me that Windows 7 needed to be installed on a Primary partition, which the last partition wasn’t.

To get this to work, we have to sacrifice the Mac OS X Lion Recovery partition. Then when we add the Windows and shared partition, the total will be 4 partitions. Deleting the Recovery partition was not a problem because I plan to make a bootable USB key containing the Mac OS X Mountion Lion install. Unfortunately, because the Recovery partition is a hidden partition, we cannot use Disk Utility to delete it. Instead, we will use the Terminal command line to erase and merge it with our Mac OS X partition.

Update: There is a way to avoid deleting the Mac OS X Recovery HD partition. I found a post, MBA13/2012: OSX + Win7 + Shared exFAT, which uses a tool called gptsync to avoid deleting the Recovery HD partition by hiding it from the Windows MBR table.

Here’s how to erase and merge the Mac OS X Lion Recovery partition:

  1. Launch the Terminal application.
  2. Run “diskutil list” to see the 3 existing partitions: EFI, Macintosh HD, and Recovery HD. (See the “diskutil list” results above.)
  3. Look for “Apple_Boot Recovery HD” partition and note its identifier, which in the above is “disk0s4”. Likewise, note that the “Apple_HFS Macintosh HD” partition’s identifier is “disk0s2”.
  4. Erase the Recovery HD partition by running “diskutil eraseVolume HFS+ Blank /dev/disk0s4”. (Format: “diskutil eraseVolume format name device”)

  5. Reclaim the erased space by merging the now blank Recovery HD partition with the Mac OS X HFS+ partition by running “diskutil mergePartitions HFS+ Lion disk0s2 disk0s4”. (Format: “diskutil mergePartitions format name fromDevice toDevice”. This is non-destructive on the first partition because the force flag is not set; and in this case, the format and name are ignored.)

  6. Note that the above steps result in 2 existing partitions: EFI and Macintosh HD.

Create Boot Camp and Shared Partitions

We are ready to create a Boot Camp partition for Windows 7 and the shared FAT32 partition. Before we start, there are two important points to keep in mind:

  • We will introduce a new step in the Boot Camp process, between the Boot Camp partition creation and Windows 7 installation. The new step involves creating the shared FAT32 partition.
  • Any change to the partition tables after Windows 7 is installed will break the Boot Camp partition. So make sure you are certain about how to size each of the partitions.

I decided to split my 750GB hard drive into 3 equal 250GB partitions for Mac OS X, Windows 7, and Shared. Here are the steps I took to create a Boot Camp with the Shared partition:

  1. Insert the Windows 7 Install DVD. Boot Camp Assistant won’t create the Windows partition without the DVD inserted.
  2. Run the Boot Camp Assistant and select only the “Install Windows 7” task.
    • If you don’t already have the latest Boot Camp 4.0 Drivers for Windows 7 available, then also select the “Download the latest Windows support software from Apple” task to create a DVD or USB flash drive containing the Boot Camp Drivers for windows.
  3. On the next screen, drag the slider to size the Windows partition; 249GB was the closest I could get to 250GB. The resulting Mac OS X partition would be the size of both the final Mac OS X and Shared partitions; in my case, 500GB. (We are short 1GB because it is used by the EFI partition. Partition sizes are not an exact science so I’m not concerned.)
  4. Note: Before hitting the Install button, be prepare to hold the Option key when the Mac reboots so we can boot from the Mac OS X partition, instead of the Windows 7 DVD.
  5. Hit the Install button. The Mac will create the Windows partition (takes a couple of minutes) and then reboot (screen goes grey and then black).
  6. Hold the Option key down during bootup and select the Mac OS X “Macintosh HD” icon when the Launch Manager appears.
  7. Back in Mac OS X, run “Disk Utility”, select the hard drive, and go to the Partition tab.
  8. Select the “Macintosh HD” partition, click the plus button to add our shared partition. A new partition is created with the name “Macintosh HD 2” which is half the size of the original “Macintosh HD” partition; which are the sizes I wanted. You can move the slider to adjust the sizes.
  9. With the “Macintosh HD 2” partition selected, choose “MS-DOS (FAT)” for the Format and “Shared” for the Name. Hit the Apply button to create the shared FAT32 partition.
  10. Restart and the Macbook will boot from the Windows 7 Install DVD to install Windows.
  11. For the Windows 7 install, hit the Next button, hit “Install now” button, check the “I accept the license terms” box, click Next button, click “Custom (advanced)” option, and select the Boot Camp partition; for me, that partition is named “Disk 0 Partition 4: BOOTCAMP”.
    • You might notice a “Disk 0 Unallocated Space” partition of 128MB. There isn’t any way to reclaim and use it.
  12. Because Boot Camp Assistant used FAT32 for the Windows partition, the Windows 7 install will disable the Next button and show an error “Windows cannot be installed to Disk 0 Partition 4” at the bottom. Clicking on “Show details” will display “Windows cannot be installed to this hard disk space. Windows must be installed to a partition formatted as NTFS.” To resolve this issue, reformat the Boot Camp partition as NTFS.
  13. With the Boot Camp partition selected, click on “Drive options (advanced)”, click on Format, click OK on the warning, and the Boot Camp partition will be formatted as NTFS. Its name will be blanked out, resulting in a “Disk 0 Partition 4” label. The error at the bottom will disappear and the Next button will be enabled.
  14. Click Next and Windows 7 will start installing itself to the Boot Camp partition. The installation took me about 30 mins, including an automatic reboot.
  15. Once Windows 7 is running, open “My Computer”, select the DVD drive, and click on Eject in the top menu to remove the Windows 7 Install DVD.
  16. Insert the Boot Camp 4.0 Drivers for Windows 7 DVD (or USB flash key) and run “setup.exe” on it to install the Boot Camp drivers. This took me about 10 minutes including another reboot.
  17. Open the Boot Camp Control Panel and select “Macintosh HD Mac OS X” as the system to start the computer with. Or you can leave it set to Windows and use the Option key when booting to select which OS to run.
  18. Double-check that you can access the “Shared” partition on Windows 7; it will show up as an additional hard drive.
  19. Restart and run Mac OS X.
  20. Check that the Shared partition is accessible. If you don’t see it in the Finder, go to the Finder’s Preferences, Sidebar, and check the “Hard disks” box under DEVICES. Alternatively, from the Terminal, you can type “cd /Volumes/Shared”.
  21. FYI, here is the final “diskutil list” output:

  22. As a last step, I launched VMware and it was able to load the Windows 7 Boot Camp successfully. Sweet.
    • Note: On startup, VMware Fusion will display a warning message “VMware Fusion is not compatible with gfxCardStatus”. You can quit gfxCardStatus or remember not to manually switch the graphics device while VMware is running.
    • Note 2: When running Windows 7 Boot Camp under VMware, the Boot Camp and Shared partitions will be unmounted from Mac OS X. When you shutdown Windows 7 Boot Camp, those partitions will be re-mounted under Mac OS X.

Most info above derived from:

5 Comments

Clone Mac OS X 10.6 Snow Leopard Install DVD to USB Flash Drive

Mac OS X 16 Comments

Update: Go to Bootable USB Flash Drive to Install Mac OS X 10.10 Yosemite if you want to install Mac OS X 10.9 Mavericks or Mac OS X 10.10 Yosemite instead. The instructions below will not work for Mac OS X 10.7 Lion or later versions.

I thought it would be useful to put the Mac OS X 10.6 Snow Leopard installer on a USB flash drive. It would be faster than reading from a DVD. I can use it with a Macbook Air or Pro Retina which do not come with a DVD drive. And the USB flash drive is more portable and robust than a DVD.

Note: I’m doing the following on a Macbook running Snow Leopard. The resulting USB flash drive will boot on Intel-based Macs only. If you want to boot the USB flash drive on a PowerPC-based Mac, please see the comments.

Create a DMG file

You can skip creating a DMG (Disk iMaGe) file if you clone directly from the Snow Leopard “Mac OS X Install DVD” disk to the USB flash drive. I just wanted a DMG file for speed and convenience; in case I need to clone to a dual-layer DVD or to another USB flash drive.

  1. Insert the Snow Leopard 10.6 “Mac OS X Install DVD” disk into the DVD drive.
  2. Run the “Disk Utility” application (under the “Applications/Utilities” folder).
  3. On the left-hand pane, you will see “Mac OS X Install DVD” appear under the DVD drive when the DVD is mounted. A “Mac OS X Install DVD” disk icon will also appear on the desktop.
    • If you don’t see the “Mac OS X Install DVD” even after waiting for a while, try closing and starting the “Disk Utility” application again.
  4. On the left-hand pane, select the “Mac OS X Install DVD” by clicking on it.
  5. Click on the “New Image” icon, located in toolbar at the top.
  6. Select the location to save the DMG file (“Mac OS X Install DVD.dmg”) to. Leave the defaults of “compressed” for “Image Format” and “none” for “Encryption”.
  7. Click on the “Save” button. The DMG file creation can take 20 minutes or longer.

Format USB Flash Drive as Mac OS X Bootable

You will need an 8GB USB flash drive. Format it as a Mac OS X bootable drive by following these steps:

  1. Insert the USB flash drive.
  2. Run “Disk Utility”.
  3. On the left-hand pane, select the USB drive (not the FAT32 or other partition under it).
  4. Click on the “Erase” tab, select “Mac OS Extended (Journaled)” for “Format” and input a name like “Snow Leopard Install USB” (or anything because this will be overwritten later).
  5. Click the “Erase…” button and then the “Erase” button. This format operation will take less than a minute to complete.
  6. Once the format completes, make sure that the USB flash drive is selected in the left-hand pane. In the bottom pane, check that the “Partition Map Scheme” is set to “GUID Partition Table” (which means it is Mac OS X bootable). Under Snow Leopard, formatting as “Mac OS Extended (Journaled)” appears to select the “GUID Partition Table” scheme by default.
  7. If you are not running Snow Leopard and the “Partition Map Scheme” is not set to “GUID Partition Table”, please repeat steps #1-3 above and then the following alternative steps:
    1. Click on the “Partition” tab, select “1 Partition” under “Volume Scheme”, ensure “Mac OS Extended (Journaled)” is selected for “format”, and leave the name alone or change it to be anything (it will be overwritten later).
    2. Click on the “Options” button and ensure that “GUID Partition Table” is selected. Click OK.
    3. Click the “Apply” button and then the “Partition” button. This format operation will take less than a minute to complete.

Restore DMG file to USB Flash Drive

Restore the DMG file to the bootable USB flash drive:

  1. Locate the “Mac OS X Install DVD.dmg” file that was created earlier. Double-click on it to mount and launch it. You will see a “Mac OS X Install DVD” disk icon appear on the desktop. You can close the “Mac OS X Install DVD” application window that was also opened.
  2. Insert the Mac OS X bootable USB flash drive that we created above.
  3. Run the “Disk Utility” application. On the left-hand pane, you should see both the USB flash drive and the mounted DMG file.
  4. On the left-hand pane, select the partition under the USB flash drive.
  5. Click on the “Restore” tab and drag that same partition (under the USB flash drive) to the “Destination” field (you will see a green plus mouse icon appear when you drag over the field).
  6. If you cannot drag the “Mac OS X Install DVD” partition under the DMG file to the “Source” field (on Snow Leopard, the green plus mouse icon won’t appear and no action is taken on the drop), you can instead right-click on the “Mac OS X Install DVD” partition and select “Set as source”. The “Source” field will then be filled with the partition name.
    • Even though you can click on the “Image…” button and select the DMG file, when you do the restore, Disk Utility will throw a “RESTORE FAILURE” error with the message: “Could not find any scan information. The source image needs to be image scanned before it can be restored.”
    • If you are cloning directly from the “Mac OS X Install” DVD, you can just drag the partition under the DVD drive to the “Source” field.
  7. I left the “Erase destination” box checked. With this box checked, the restore operation took about 25 minutes. When this box was unchecked, the restore operation reported that it would require 4 hours.
  8. Click the “Restore” button, then the “Erase” button, and input your Mac OS X administrative password.
  9. When the restore completes, you may see two “Mac OS X Install DVD” application windows appear, the first from the mounted DMG file and second from the USB flash drive. There will also be two “Mac OS X Install DVD” disk icons on the desktop. Also, notice that the partition under the USB flash drive is now named the same as the source, “Mac OS X Install DVD”.
  10. Select the USB flash drive in the left-hand pane. In the bottom pane, double-check that the “Partition Map Scheme” is still set to “GUID Partition Table”.
    • If you are not using Snow Leopard and find that the “Partition Map Scheme” is no longer set to “GUID Partition Table”, you may need to redo the restore. Reformat the USB flash drive (per the alternative instructions above) and before doing the restore, uncheck the “Erase destination” box. I fear that the “Erase destination” function may modify the partition map scheme to be something other than “GUID Partition Table”.

Boot from the USB Flash Drive

  1. Insert the USB flash drive.
  2. While starting your Mac, hold the Alt/Option key down to launch the Startup Manager.
  3. Select the USB flash drive to boot from; it will be labeled “Mac OS X Install DVD”.

Most of the information above was derived from:

16 Comments

Triple Boot Mac OS X 10.6, Windows XP, and Windows 7

Mac OS X 8 Comments

The Boot Camp software on my Macbook Pro allows me to dual boot between Mac OS X 10.6 and Windows 7. However, I also wanted the option to boot into Windows XP because I test software that needs to run under both Windows XP and 7. Unfortunately, Boot Camp does not support more than one Windows OS. Thank goodness the open source movement provided the solution in the form of rEFIt.

rEFIt is Da Bomb!

rEFIt is a boot menu tool which allows you to triple boot on Intel Macs. If you have ever activated Boot Camp by holding the Option key on startup and have been offered a selection of two icons (for Mac OS X and Windows), rEFIt can provide a similar menu but with three icons.

I managed to get the triple boot working by following instructions found in a forum post named Triple Boot Mac OS X + XP + 7 (search for the reply from “simscada”). I did not follow the sequence of steps exactly because I wanted to save my existing Windows 7 Boot Camp installation. I was unsuccessful but still got the triple boot working in the end.

The first thing I did was to download and install rEFIt under Mac OS X. I then had to reboot twice before I saw the rEFIt menu on bootup. The rEFIt boot menu will always appear on startup by default. During the process of setting up the triple boot, sometimes I saw extraneous boot icons for the hidden EFI partition (aka Mac OS X system boot partition), a “Boot Legacy OS” (don’t know what that is), and the DVD-ROM drive. At the end, those extraneous boot icons went away. So just ignore them if you see them.

Note: The hidden EFI partition is really the first partition. The Mac OS X partition is the second partition. However, to avoid the confusion (or maybe to add to it), I will ignore the hidden EFI partition and will refer to the Mac OS X partition as the first partition.

Epic Failure: Attempt To Save Existing Windows 7 Boot Camp

Even though the post stated that Windows XP needed to be installed in the last partition, I decided to see if it would work otherwise. I shrunk the Mac OS X partition to make space for Windows XP between the Mac OS X partition (first partition) and the existing Windows 7 Boot Camp partition (last partition). I then installed Windows XP and after rebooting, found that neither the new Windows XP or the existing Windows 7 would successfully boot.

  • Windows XP gave me this error: “Windows could not start because the following file is missing or corrupt: \system32\ntoskrnl.exe. Please re-install a copy of the above file.”
  • Windows 7 gave me this error: “NTLDR is missing”.

Supposedly, some commercial partition tools for Mac OS X would have allowed me to free space at the end for Windows XP (without destroying the existing Windows 7), but I didn’t want to spend the money.

First: Create Windows 7 and XP Partitions

To prepare the hard drive for triple boot, I had to shrink my Mac OS X partition (first partition) and delete my existing Windows 7 Boot Camp partition in order to create two new partitions, one for Windows 7 (second partition) and the other for Windows XP (third and last partition).

My Macbook Pro had a 320GB hard drive and I decided to size them like so:

Partition Size OS
1 140GB Mac OS X 10.6
2 140GB Windows 7
3 40GB Windows XP

The above size allocations reflect my predicted usage pattern and accounts for the minimal installation size for each OS. A bare installation of Windows 7 takes 25GB and a bare installation of Windows XP takes 5GB. Microsoft Office 2007 takes an additional 15GB. I will be using Windows XP mostly for testing so don’t plan to install much software on it. I plan to use Windows 7 and Mac OS X equally.

Note: Per simscada’s instructions and my experiment otherwise, you must install Windows XP in the last partition on the hard drive in order for the triple boot to work.

I created the partitions using the Disk Utility which comes with Mac OS X. I did not need to re-install Mac OS X (per simscada’s instructions) because Disk Utility allowed me to resize the existing Mac OS X partition without destroying the OS on it.

Here’s how I added the Windows 7 and XP partitions:

  1. Run the “Disk Utility” application under Mac OS X. Select the hard drive on the left and click on the “Partition” tab on the right. You will see a nice graph of the hard drive with the Mac OS X partition as a rectangle.
  2. Delete the existing Boot Camp partition if you have one. The Mac OS X partition rectangle in the graph will grow to reclaim the unused space.
    • Note: We will be doing resize and add partition operations using the graph. Changes are not applied until you hit the Apply button to the bottom right. You can revert changes at any time by hitting the Revert button. However, if you remove an existing partition (like a Boot Camp partition) by selecting it and hitting the minus sign (at the bottom of the graph), the remove operation will be applied immediately!
  3. Select the Mac OS X partition and click the plus sign under the graph to create a new partition. This new partition will take up portions of the free space or unused partition space.
  4. Select the new partition and click the plus sign again to create another new partition. Both new partitions will have the same size.
  5. Resize the three partitions by clicking on the right-bottom corner of their rectangles and dragging up/down. Alternatively, you can just select the partition and input the desired size (in GB) in the “Size” field to the right of the graph. Note: Adjusting the second partition size will re-adjust the third partition size accordingly.
  6. For the new Windows partitions, I updated the “Name” field to be “Win7” or “WinXP” (make sure Windows XP is the last partition) and the “Format” field to be “MS-DOS (FAT)”. The names will help later to identify the partitions. When installing Windows, we will reformat the MS-DOS format to NTFS.
  7. Once you are satisfied with the partition sizes (make sure to leave some free, non-purple space in the Mac OS X partition), click on the Apply button. Input your admin password when prompted for.
  8. The Mac OS X partition resize took a while to apply (like 20-30 minutes). The new partition creations were very fast (a few seconds).

Second: Install Windows 7

Here are the steps I took to install Windows 7:

  1. Inserted the Windows 7 Installation DVD and reboot the Mac computer. On restart, hold down the “C” key to boot from the DVD. You will see a brief message “Press any key to boot from CD” appear and disappear, and then the Windows 7 startup screen.
  2. During the Windows 7 installation, I was prompted with the following partitions:
    Partition Size Type Note
    Disk 0 Partition 1 200.0MB Primary This is the hidden EFI partition.
    Disk 0 Partition 2 130.4GB Primary This is the Mac OS X partition which we confusing refer to as the first partition.
    Disk 0 Unallocated Space 128.0MB This is some leftover space from creating the partitions.
    Disk 0 Partition 3: WIN7 130.3GB System The Windows 7 partition which we refer to as the second partition.
    Disk 0 Partition 4: WINXP 37.0GB Primary The Windows XP partition which we call the third partition.
  3. Prepare the Windows 7 partition by formatting it as NTFS: Select the WIN7 partition, click on “Drive options (advanced)”, and click “Format” to format the WIN7 partition as NTFS. The format will cause the partition to lose the “WIN7” label.
  4. When the format is done, the Next button will then become enabled. Click Next to finish the install.
  5. Windows will reboot once and maybe twice.
  6. Note: When rebooting, in the rEFIt menu, choose the Windows icon to boot with. The Windows icon will be named “Boot Windows from Partition 3” (don’t forget that because of the hidden EFI partition, our second Windows 7 partition is actually the third partition… confused yet?). If you don’t select anything within 20 seconds, rEFIt will boot the Mac OS X automatically. If that happens, just restart manually and make sure to select the Windows 7 partition to boot from.

In order to fully use the Mac hardware under Windows, I had to install the Boot Camp drivers, the outdated version of which are conveniently located on the Mac OS X installation DVD (…what, download the drivers from the Internet? That is so not the apple.com way). While running Windows 7, do the following:

  1. Oh my gosh, I can’t insert the Mac OS X DVD because the Windows 7 DVD is in the hard drive and the Mac slot drive has no Eject button (well, there is an Eject button on the Mac keyboard but that doesn’t work without the Boot Camp driver).
  2. Don’t worry, Microsoft has you covered under Windows 7: open Explorer, select the DVD drive, and click Eject on the top action menu. (Unfortunately, this doesn’t work under Windows XP. Read on to find how to do it under Windows XP. This is how I use suspense to keep you riveted.)
  3. Insert the Mac OS X Install DVD, run the “setup.exe”, and accept the default install options to install the Boot Camp drivers for the Mac hardware.
  4. If you like to tap instead of click (and two fingers tap for right-click), here’s how to configure the trackpad to accept taps:
    • Run “Boot Camp” (you can run it directly or click on the dark grey diamond Boot Camp icon in the system tray and select “Boot Camp Control Panel…”).
    • Click the Trackpad tab.
    • Check the “Tap to Click” and “Dragging” options under the “One Finger” section.
    • Check the “Secondary Tap” option under the “Two Fingers” section.
    • Note: One issue I noticed is that when I double-tap to drag, I have to double-tap, wait a half second before I am able to drag. It is a Boot Camp driver issue that Apple hasn’t fixed yet (if ever).
  5. You can run the “Apple Software Update” to update the Boot Camp software now or later.

The last and very important action is to use Windows 7 to mark the last Windows XP partition as bootable (aka make it “Active”):

  1. Run “Computer Management” (or right-click on Computer and select Manage).
  2. Go to “Storage->Disk Management” tab.
  3. Select the WinXP partition, right-click, and select “Mark Partition as Active”. You will see the label “Healthy (Primary Partition)” change to “Healthy (Active, Primary Partition)”. You are basically marking the partition as a bootable partition containing an operating system.
  4. While you are here, you can rename the label for the Windows 7 partition (look for “C:” drive) to be something like “Win7”. (You might notice that the Boot Camp driver installation had renamed the partition as “Boot Camp” previously.)

Third: Install Windows XP

Finally, install Windows XP into the last partition.

  1. Before rebooting, remove the Mac OS X Installation DVD and insert the Windows XP Installation CD.
  2. On bootup, hold the “C” key to boot from the Windows XP CD. You will see a brief message “Press any key to boot from CD” appear and disappear before the Windows XP installation screen displays.
  3. During Windows XP installation, I was prompted with the following list of partitions:
    Drive Label Partition Size Note
    G: Partition1 [Unknown] 200 MB Hidden EFI partition
    H: Partition2 [Unknown] 133514 MB Mac OS X
    Unpartitioned space 129 MB Leftover space
    E: Partition3 (WIN7) [NTFS] 133513 MB Windows 7
    C: Partition4 (WINXP) [FAT32] 37889 MB Our target Windows XP partition
  4. Select the “Partition4 (WINXP)”, hit the Enter key, and then select “Format the partition using the NTFS file system (Quick)” option. Per another reply in the forum post, do not select the “Leave the current file system intact (no changes)” option.
  5. Once the Windows XP installation completes and reboots, I now see two Windows icons (in addition to the Mac OS X icon) in the rEFIt menu. I selected the second Windows icon (named “Boot Windows from Partition 4”) to start up Windows XP. It booted into Windows XP successfully! Yippee! After some configuration, Windows XP will reboot a second time.
  6. On the second reboot (or if you miss it, just manually reboot), select the first Windows 7 icon so you verify that Windows 7 can still be started and also, so you can eject the Windows XP CD. (I couldn’t find a way to eject a CD under Windows XP because I couldn’t access the right-click menu with the one-button Mac trackpad. And I didn’t have a normal USB mouse available. Bummer.)
  7. Reboot into Windows XP, insert the Mac OS X Installation DVD, and install the Boot Camp drivers so you can configure the Mac hardware. Follow the instructions under the Windows 7 section above to configure right-click tap functionality for the Mac trackpad.

You can use “Computer Management” under Windows XP (or Windows 7) to rename the Windows XP partition to something like “WinXP”.

Fourth: Prevent Windows 7 chkdsk From Breaking Windows XP Permissions

I found this out the hard way. If any file gets corrupted (say from a power outage), Windows 7 will do a chkdsk (check disk) operation on its own partition and the Windows XP partition. Unfortunately, Windows 7 chkdsk does not like the Windows XP permission settings on files in the XP partition and will “correct” them, breaking the Windows XP installation. This will happen if on Windows 7 startup, you were unable to cancel the chkdsk in time and you see a bunch of chkdsk messages like “Deleting an index entry with id 311 from index $SDH of file 9” and “Replacing invalid security id with default security id for file filename #1093”; the latter message could occur from 10,000 to 100,000 times and will take 15-20 minutes to complete.

To prevent Windows 7 from automatically running a chkdsk command on the Windows XP partition, do the following:

  1. Start Windows 7.
  2. Run “Command Prompt”.
  3. Type this command:
    chkntfs /X D:

    (where D: is the drive letter assigned to the Windows XP partition)

I suggest doing the same under Windows XP to prevent Windows XP chkdsk from being run on the Windows 7 partition (not sure if anything bad will happen but let’s not find out).

If you were affected by this chkdsk issue, there is a way to recover. Just let the Windows 7 chkdsk complete. Once chkdsk is done, follow these steps to reset the Windows XP permissions:

  1. Start Windows XP and log in as the “administrator” user.
  2. If you see only the mouse cursor and an empty desktop, do the following:
    • Hit Ctrl-Alt-Del (with the Macbook keyboard, you will also need to hold down the Fn key) to launch the Task Manager.
    • Go to menu “File->New Task”, type in “explorer”, and hit Ok. The start bar and desktop icons should appear.
  3. Open “My Computer”.
  4. Go to menu “Tools->Folder Options->View” and uncheck “Use simple file sharing (Recommended)”. This is necessary so you can see the Security tab in the properties for drives and folders. Hit Ok.
  5. Back in “My Computer”, right-click on the C: drive and select “Sharing and Security…”.
  6. Click on the Security tab and then the Advanced button near the bottom-right.
  7. Double-check that the “Administrators” group has “Full Control” permission set. If not, then set it. (If your normal user account is not an administrator account, you may need to recreate it once these steps are completed.)
  8. Check the “replace permission entries on all child objects with entries shown here that apply to child objects” box.
  9. Hit Apply and say Yes to the security warning popup dialog. The permissions on all the folders and files on the C: drive will now be reset to give full control to Administrators.
  10. Once the permission reset is complete, test that permissions are valid by right-clicking on “My Computer”, selecting Manage and then Disk Management. It should show you the drives and partitions.

Windows 7 may also break the Windows XP Recycle Bin. If this occurs, on startup, Windows 7 will prompt you with “The Recycle Bin on D:\ is corrupted. Do you want to empty the Recycle Bin for this drive?” Answer yes or no. The fix for this is to delete the Windows XP Recycle Bin (Windows XP will re-create it):

  1. While running Windows 7, launch the Command Prompt.
  2. Type the following commands to delete the Windows XP Recycle Bin, supposing that the D: drive is the Windows XP partition.
    D:
    rmdir /s /q $RECYCLE.BIN
    rmdir /s /q RECYCLER

You can also do the above while running Windows XP in Safe Mode; just don’t switch to the D: drive because that would probably be the Windows 7 partition under Windows XP.

Leftovers

Surprisingly, Mac OS X 10.6 can read the NTFS drives and Windows XP and 7 can read the Mac’s HFS+ (aka Mac OS Extended) drive. The latter is enabled by the Boot Camp driver installation on Windows. Unfortunately, write access is not allowed for either case.

If you are using VMware Fusion and was able to load the old Windows 7 Boot Camp installation (which we deleted as part of the triple boot process) previously, you can load the new Windows 7 partition with a simple change. Before running VMware Fusion, delete the outdated subfolder (which has a strange name like “%2Fdev%2Fdisk0”) under the “~\Library\Application Support\VMware Fusion\Virtual Machines\Boot Camp” folder. When VMware Fusion next runs, it will regenerate the necessary info to be able to load the new Windows 7 partition. (I’m not sure if there is a way for VMware Fusion to load the new Windows XP partition also.)

I found a hint that the rEFIt boot icon labels can be renamed. So instead of “Boot Windows from Partition 3”, the icon could say “Windows 7”. And instead of “Boot Windows from Partition 4”, the icon could say “Windows XP”. Unfortunately, I couldn’t find the specific instructions anywhere on how to accomplish this.

I wish you success in getting your Mac computer to triple boot.

8 Comments

Configure Wireless Access for the Brother HL-2280DW Multi-Function Laser Printer

Mac OS X, Windows 60 Comments

I scored a great deal on two Brother HL-2280DW Wireless Laser Printers (with scanner functions) during Thanksgiving break. Once I got the printers and tried to configure them for wireless, I found that Brother’s wireless configuration options were lacking and in some cases, didn’t work at all.

Unfortunately, the Ethernet connectivity on one of the printers was broken; worse, that was the printer I picked first to configure. After wasting half the weekend, I thought I would document how I finally went about configuring the wireless access for the Brother HL-2280DW printer and adding it to my Windows and Mac OS X machines. Hopefully, the steps below will help you with your Brother printer woes.

Note: The instructions below will work for other Brother wireless printers. I’ve also tried them successfully with Brother HL-2170W, HL-2270DW, and MFC-7860DW printers.

Note: I recently setup the newest model Brother HL-L2380DW printer. Unfortunately, I had to configured the printer to use a static IP address in order for it to be used from Windows 7. If you don’t configure a static IP address, when you install the Windows HL-L2380DW printer drivers, the installer will say that the printer is not configured properly and offer to configure it (set a static IP address). Mac OS X did not require the printer to have a static IP address.

Configure Wireless Access With Ethernet Connection and Web Interface

Note: The WPS and “WPS with Pin” setup did not work with my Cisco Linksys E1000 router. And while the printer allowed me to manually input the SSID and passphrase using the up/down arrows, the printer’s LCD only displayed the first 10-12 digits of the passphrase making it impossible to input the rest! Because I dislike using the USB method (which required installing, uninstalling, and then re-installing software), I decided that using the printer’s Ethernet connection and web interface was the best solution.

  1. Before we start, you will need to know the following info concerning your wireless network (check your wireless router’s configuration):
    • Network ID (SSID)
    • Channel Number (usually 3, 7, or 11)
    • Authentication Method (WEP, WPA or WPA2)
    • Encryption Mode (TKIP or AES)
  2. Follow the included Brother “Start Here” manual to prepare the printer for operation.
  3. Before turning on the printer, connect it to your wireless router by Ethernet cable.
  4. After the printer is on, we will need to find its assigned IP address:
    • Look it up on the printer:
      1. Press the Menu button to the right of the printer’s LCD and you will see “1. General Setup” menu item show up. You might need to press the Menu button twice sometimes. (Do not select the “1. General Setup” item.)
      2. Select the following menu items by pressing the up/down arrows and clicking on the OK button:
        • 4. Network
        • 1. Wired LAN
        • 1. TCP/IP
        • 2. IP Address
    • Alternatively, you can browse to your wireless router’s web interface and look at the list of connected DHCP clients.
  5. Browse to the printer’s assigned IP address to access its web interface.
  6. Configure the printer to enable toner save mode and to allow printing even if the toner is low:
    1. Click on “General Setup” at the top.
    2. You will be prompted for the user/password. Input the default: admin/access.
    3. Set the following options:
      • Toner Save: On
      • Replace Toner: Continue
    4. Click on the Submit button
  7. Configure the wireless network access:
    1. Click on “Network Configuration” link at the top.
    2. Click on the “Configure Wireless” link near the bottom of the page.
    3. Configure the following options:
      • Communication Mode: “1) Infrastructure Mode”
      • SSID: [input your wireless ID]
      • Channel: [input the wireless channel]
      • Authentication Method: WPA/WPA2-PSK (usually)
      • Encryption Mode: AES (usually for WPA2)
      • Passphrase: [input your wireless password]
    4. Click the Submit button.
    5. Answer Yes to “Would you like to enable the wireless interface?”.
    6. You will get a message to unplug the Ethernet cable. The printer will reboot and then print a page indicating whether the wireless connection succeeded or not.
  8. If the wireless connection didn’t succeed, then connect the Ethernet cable and repeat from step #4. Usually, the wireless router will give the printer the same IP address.
  9. If you are totally lost, you can reset the printer configuration by doing the following:
    1. Click on the Menu button next to the printer’s LCD.
    2. Select the following with the up/down arrows and the OK button:
      • 1. General Setup
      • 5. Reset
      • 2. All Settings
    3. Hit the Up arrow to Reboot.

Mac OS X: Add Printer, Set Toner Save Mode, and Scan

To add the printer on Mac OS X, do the following:

  1. Open up System Preferences.
  2. Click on “Print & Fax” under Hardware.
  3. Click the Plus button underneath the list of printers on the left.
  4. Bonjour should detect the printer and you will see “Brother HL-2280DW” listed.
  5. Select it and the “Print Using:” field will populate with “Brother HL-2280DW CUPS” driver.
  6. Click the Add button.
  7. The Brother HL-2280DW should show up on the list of Printers. To make it the default printer, double-click on it and select “Set default printer”.

To configure Mac OS X to use Toner Save Mode by default:

  1. Browse to the local CUPS driver web interface running on your machine. (You may be asked to run “cupsctl WebInterface=yes” in the Terminal application to enable the CUPS web interface.)
  2. Click on the Printers tab to the top-right.
  3. Click on the “Brother_HL_2280DW” printer in the list.
  4. Click on the Administration drop-down list box and select “Set Default Options”.
  5. Change “Toner Save Mode” to be “On”.
  6. Click on “Set Default Options” button.
  7. If you are prompted for a user/password, input your Mac OS X login username and the administration password.

The built-in way to do a scan on Mac OS X:

  1. Open up System Preferences.
  2. Click on “Print & Fax” under Hardware.
  3. Select the printer.
  4. Click on the “Scan” tab.
  5. Click the “Open Scanner…” button.
  6. Click “Show Details” for more options like output format and location.
  7. Make your selections and click on the “Scan” button.
  8. The scan will be taken and saved to the “Pictures” folder by default.

Windows XP and 7: Add Printer, Set Toner Save Mode, and Scan

To add the printer on Windows, do the following:

  1. Download the latest Brothers HL-2280DW printer software (it is the same file for Windows XP, Windows 7 32-bit, and Windows 7 64-bit and is named “HL-2280DW-inst-B1-usa.EXE”).
  2. Run the downloaded installation executable.
  3. Select “usa” for language. Click OK.
  4. Select “Wireless Network Connection” and check “Custom Install”.
  5. Take the default for “Change the Firewall port settings…”. Click Next.
  6. Take the default selected features (all are selected) and click Next.
  7. I usually select “No, I don’t want to register this PC to ‘Scan To’ button”; however, feel free to select Yes. (I think this option is so when you press the Scan button on the printer, it will send the image to this computer.) Click Next.
  8. On Windows XP:
    1. Keep the “Search the network for devices…” selected and click Next.
    2. Select the found Brother printer (the node name looks like “BRxxxxxxxxxx”) and click Next.
  9. On Windows 7, the printer detection doesn’t work so you will select either “Specify your machine by address” (IP address) or “Specify your machine by name” (node name/hostname). I usually do it by using the node name:
    1. To lookup the node name, go to the printer, press the Menu button, select “4. Network”, “2. WLAN”, “1. TCP/IP”, and “5. Node Name”. (Alternatively, the wireless router’s DHCP client table should have the printer’s hostname which is the same as the node name.)
    2. Back in the Brother setup dialog, select “Specify your machine by name” and input the node name.
    3. Click Next.
  10. The installation program will take several minutes to install the various Brother driver and tools.
  11. Click Next and Next to skip the “User’s Guides” and “On-Line Registration”.
  12. I usually uncheck “Enable Status Monitor on startup” and leave the “Set as Default Printer” checked. Click Next.
  13. The setup will request a reboot.
  14. After the reboot, you will see a new, red “CC4” icon in the status tray. This is the Brother Control Center software which allows you to set device properties, print, and scan. Because I prefer using my own programs to scan, I usually remove this from the tray by doing the following:
    1. Right-click on the CC4 icon and select “Preferences”.
    2. Unselect “Start ControlCenter on computer startup”.
    3. Hit the OK button.
    4. Right-click the CC4 icon and select “Close”.
  15. (OPTIONAL) Even though I have configured the Brother software to not run Control Center and the Status Monitor (unchecked “Enable Status Monitor on startup” in last page of installation wizard), Brother still runs them stealthily on startup. To really get rid of them, I had to do the following:
    1. Run “msconfig”.
    2. Select Startup tab.
    3. Under Windows 7, uncheck “Brother ControlCenter” and “Brother Status Monitor Application”.
    4. Under Windows XP, uncheck “BrCcBoot” and “BrStMonW”.
    5. Click Apply and then click OK.
    6. You may be prompted to restart.

To configure Windows to use Toner Save Mode by default:

  1. Go to menu “Start->Control Panel”.
  2. On Windows XP:
    1. Click on “Printers and Other Hardware”.
    2. Click on “View installed printers or fax machines”.
    3. Right-click on printer and select “Printer Preferences” to open the “Brother HL-2280DW Printer Printing Preferences” dialog.
  3. On Windows 7:
    1. Click on “View devices and printers”.
    2. Double-click on the Brother printer to open it.
    3. Double-click “Adjust print options” to open the “Brother HL-2280DW Printer Printing Preferences” dialog.
  4. In the Printer Preferences dialog:
    1. Select the Advanced tab.
    2. Check the “Toner Save Mode” option.
    3. Hit the Apply button and then the OK button.

The built-in way to do a scan on Windows XP:

  1. Run “Start->All Programs->Accessories->Scanner and Camera Wizard”.
  2. The Brother printer will be listed at the top. Click Next.
  3. Click on Preview, select options, and click Next.
  4. Select output format and folder. Click Next.
  5. The scan will be taken and saved to the “My Pictures” folder by default.

The built-in way to do a scan on Windows 7:

  1. Run “Windows Fax and Scan”.
  2. Click the “New Scan” button in the top toolbar.
  3. Hit Preview to see a preview image.
  4. Select the options and hit Scan.
  5. The scan will be taken and saved to the “Documents\Scanned Documents” folder by default.

One Button Scanning With Control Center

If you plan to do a lot of scanning, the Brother Control Center software (you’ll need to download and install it separately on Mac OS X) allows you to pre-configure the scan to file properties (including directory to save to and DPI quality). Once configured, you will only need to press the Control Center software’s scan button once to take a scan.

Note: The Scan To PC function allows you to press the hardware Scan key on the printer to save the file to your computer. You can configure this function using the Control Center. When adding the Brother scanner to Control Center, make sure to configure the “Scan Key” with a name. Unfortunately, using the Scan key on the printer requires multiple selection key presses, so it is not as convenient as the Control Center’s software scan key.

Though I refer specifically to the Brother HL-2280DW, these instructions most likely apply to other Brother wireless printer models.

60 Comments

Migrating from Windows XP to Mac OS X, Part 2

Mac OS X No Comments

stevejobsIt has been over a year since I migrated to a Macbook Pro laptop and started using the Mac OS X operating system. Since then, I have learned some useful tips and tricks, which I have shared below.

Using Keyboard Shortcuts

If you can master keyboard shortcuts, you will be able to perform some actions (especially repetitive ones) much faster than using the trackpad.

Enable Tabbing Between All Controls

This will allow you to tab to any control, such as a button, in a window or dialog.

  1. Go to “System Preferences” and Keyboard.
  2. In the “Full Keyboard Access: …” section at the bottom, make sure that the “All controls” radio option is checked.

Strangely, after you tab to a button, some dialogs require you to press the Return key and other dialogs require you to press the Space key in order to “click” the button.

Perform a Screen Capture

Use the following key combinations to perform either a full screenshot or a cropped screenshot:

  • Simultaneously press Apple + Shift + 3 keys to perform a full screenshot.
  • Simultaneously press Apple + Shift + 4 keys to enter cropped screenshot mode, where the cursor becomes a target icon. Click down, without releasing, to pick a corner of the shot and drag to frame the shot (you will see a translucent rectangle). Release to take the cropped screenshot.

The screenshots will appear on your desktop as PNG image files.

Deleting Files

Select one or more files and simultaneously press Apple + Delete keys to delete them. This key combination will also work to delete folders. The deleted files and folders are placed in the waste basket.

Force Quit an Application

If your Mac OS X appears to be frozen due to an unresponsive program, one drastic measure is to kill that program’s process. Simultaneously press Command + Option + Esc keys to open up the “Force Quit Applications” dialog, select the offending application, and click on the “Force Quit” button.

Note: For more details on running applications (in addition to disk, memory, and network usage), you can launch the “Activity Monitor”.

Just for Fun

There are a ton of keyboard shortcuts. You just have to find the ones most useful to you. For example, here’s a fun shortcut: press Fn + Shift + F10 keys to make the current window bright and slowly move to the center, while everything else fades away.

Command Line With Terminal

The Terminal application is equivalent to the Linux shell or the DOS command prompt. For certain activities such as writing scripts or doing development, I prefer to use the command line. So I was very glad that Mac OS X came with the Terminal application. One can open several Terminals and even skin them so they will be partially transparent.

Launch an Application

One can launch a Mac OS X application from the Terminal by issuing the following commands:

  • Run “open [application | file | directory | URL]” to launch a particular application (ex: “/Applications/TextEdit.app”), open a file with its default associated application, open a directory using Finder, or browse to a URL using the default browser respectively.
  • Run “open -e [file]” to open a file with the TextEdit application.
  • Run “open -a [application] [file]” to open a file using the specified application.

Debug the Wireless Network

Mac OS X comes with a nifty command line wireless utility called airport. To enable easy access to it, run the following to put it in the command line’s search path:

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

Once you have run the above, you can now issue the following commands:

  • Run “airport -I” to see the current wireless status, what SSID you are connected to and the strength of the signal. Note that some of this info is also shown if you hold down Option key while clicking on the Airport status icon in the top menu bar (on the right-hand side).
  • Run “airport -s” to scan the wireless broadcast space.
  • Run “airport -z” to disassociate from any wireless network.

Some other useful commands are:

  • Run “ifconfig en1” to see your machine’s assigned IP address on the wireless network.
  • Run “dscacheutil -flushcache” to flush the DNS cache.

Where’s My CD?

To access another partition or a CD using Terminal, change to the “/Volumes” directory.

Reset Your Admin Password

If you ever forget your administrative password, there are two easy methods to reset the password. One requires the Mac OS X Install CD and the other does not.

Require the Mac OS X Install CD

First method is to boot from the Mac OS X Install CD and run the reset password application.

  1. Insert the Mac OS X Install CD and restart the Mac.
  2. Hold the “C” key on startup to boot from the CD.
  3. Once the specialized Mac OS X operating system on the CD is booted, go to menu “Utilities->Password Reset”.
  4. Select the Mac OS X hard drive.
  5. Select your username and input the new password.
  6. Restart the Mac.

Don’t Require Mac OS X Install CD

Second method uses single user mode and does not require the Mac OS X Install CD.

  1. Restart the Mac.
  2. On startup, hold the Command + S keys down to boot into single user mode.
  3. Once you have Terminal access, input the following commands to reset your password:
    mount -uw /
    ls /Users
    passwd [your_username]
    shutdown -r now

    The second command will show the list of users, one of which will be your username.

  4. Alternatively, if you wish to have Mac OS X prompt you to create a new administrative user, run the following command instead of the “passwd [your_username]”:
    rm /var/db/.AppleSetupDone

    Deleting the .AppleSetupDone file will cause Mac OS X to re-run the setup wizard on bootup, which will prompt you to create a new user account with administrative permission. You can then run “System Preferences->Accounts” to reset any user’s password.

Note: Did you know that Mac OS X, like Windows, has a Safe Mode? If you ever need it, just hold the Shift key on bootup to go into Safe Mode.

Boot Camp for the Schizophrenic

Boot Camp comes with Mac OS X and allows you to dual-boot into either Mac OS X or Windows. It is very easy to setup as long as you have an official Windows installation CD with product key. The only decision you have to make is how much space to allocate to Windows; I recommend 32GB or more for Windows 7 to allow space for applications.

Install Windows

Run “Boot Camp Assistant” and follow the directions.

  • The Windows Support Software can be considered Windows drivers for Mac hardware such as video cards, trackpad, etc. I consider it a requirement, otherwise Windows would not perform well on the Mac.
  • For the “Download Windows Support Software” page, I selected the second option since I had the Mac OS X Installation CD. I did try the first option “Download the Windows support software…” on another Macbook but it failed after several minutes; maybe you will have better luck if you use this option.
  • Per the instructions, insert the Windows installation CD and start the Boot Camp installation.
  • Note: I recommend using an official, unmodified Windows CD. I tried this with a customized, no interaction Windows Install CD and its custom installation script repartitioned the whole drive as a Windows partition (thereby destroying the Mac OS X partition). To recover, I had to reinstall the Mac OS X operating system from scratch.

Configure Windows

Once Boot Camp is installed, on startup, just hold the Option key down and you will be presented with a menu to select either Mac OS X or Windows to boot into. When you are in Windows, insert the Mac OS X Install CD to install the necessary Apple Windows drivers. Once installed, you will see a Boot Camp icon in the bottom-right dock which will allow you to configure the Trackpad, which OS to boot by default, etc.

Mac Keyboards Are Strange!

You will need to either get used to using Windows with the Mac keyboard or alternatively, to remap the Mac keys to match Windows.

Emacs The Way You Want It

Mac OS X comes with a command line version of Emacs. However, I’ve gotten used to GNU Emacs on Windows and wanted the same on the Mac OS X. Here’s how to install GNU Emacs on your Mac:

  1. Download the latest GNU Emacs for Mac OS X.
  2. Open the disk image and copy Emacs.app to the “/Applications” folder.
  3. You can launch GNU Emacs from the command line using “open -a /Applications/Emacs.app [file]”.

Customize Emacs

If you want to customize Emacs to disable the startup splash screen and enable mouse scrolling, create a “~/.emacs” file with the following content:

;;Prevent startup splash screen
(setq inhibit-splash-screen t)

;;Increase width to 120 chars
(add-to-list 'default-frame-alist (cons 'width 120))

;;Set tab to be displayed as 4 spaces, not the default 8
(setq-default tab-width 4)

;;Enable wheelmouse support
(require 'mwheel)

;;Define the mouse scroll wheel
(defun up-slightly () (interactive) (scroll-up 5))
(defun down-slightly () (interactive) (scroll-down 5))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)

;;Support for scrolling (two finger scrolling is double-wheel-up/down)
(global-set-key [wheel-down] 'up-slightly)
(global-set-key [wheel-up] 'down-slightly)
(global-set-key [double-wheel-down] 'up-slightly)
(global-set-key [double-wheel-up] 'down-slightly)
(global-set-key [triple-wheel-down] 'up-slightly)
(global-set-key [triple-wheel-up] 'down-slightly)

Restart Emacs for the changes to take effect.

Remove Windows Return Characters

Files from Windows may contain return characters which show up as visually distracting ^M characters in Emacs. Worse, the Windows return characters inside a bash script file will cause errors on execution. To remove the Windows return characters, open the file in Emacs and perform one of these two methods:

  1. Type “Esc-x set-buffer-file-coding-system”, Enter key, “unix”, Enter key to switch the format to Unix (from Windows).
  2. Type “Esc-x replace-string Ctrl-q Ctrl-m” and Enter key to replace the Windows return characters with nothing. The Ctrl-q will allow you to type control characters into the input buffer, such as Ctrl-m for the Windows return character.

Miscellaneous

This is the dumping ground for random, but possibly useful tips.

VMWare Fusion

When using VMWare Fusion running Windows, you will need to add Fn to the normal Windows keyboard shortcuts. For example:

  • Use Fn + Control + Option + Delete keys to issue a Windows Ctrl-Alt-Delete command.
  • Use Fn + Delete to issue a Windows Delete command.

Firefox

To run Firefox in 32bit mode by default (so some legacy plugins can work):

  1. Go to /Application and select the Firefox icon.
  2. Left-click and select “Get Info” on the Firefox application.
  3. Check the “Open in 32-bit mode” box.

Did you know that you can issue commands in the Firefox address bar? Try the following:

  • Input “about:blank” to get a blank page. (You can also set this as the home page.)
  • Input “about:sessionrestore” to load the tabs that were opened in the previous session. Try using this if Firefox complains that it is unable to recover your saved tabs on startup.
  • Input “about:plugins” to see a description of all the installed plugins.

The above will work in Firefox running on all supported operating systems.

Hopefully all the tips here will help you to enjoy your own Mac migration.

No Comments

Compile VLC Player for Android on Mac OS X Snow Leopard

Mac OS X 4 Comments

vlcplayerIn this post, I will outline the steps necessary to compile the VLC Player for Android devices. As a pre-requisite, please see my post about installing Eclipse Indigo for Android Development on Mac OS X Snow Leopard.

Prepare Your System for VLC Compilation:

  1. Download the latest Apple Xcode development tool suite. Xcode is required by MacPorts below. (I downloaded Xcode 4.0.2 and iOS SDK 4.3)
    • Update: For the latest Xcode 4.5.1 (which I installed from the Mac App Store), after you install it, you will need to manually install the “Command Line Tools” which are required by Macports. To do so: go to Xcode->Preferences, Downloads, and click on “Install” for “Command Line Tools”.
    • (You will need to create a free Apple account, if you don’t already have one. This can be the same as your iTunes account.)
    • Double-click on the downloaded “xcode_4.0.2_and_ios_sdk_4.3.dmg” to mount the disk image.
    • It will show up on your desktop as a new drive “Xcode and iOS SDK”. Open the drive (if it doesn’t automatically open), launch the “Xcode and iOS SDK.mpkg” file, and follow the installation wizard instructions.
  2. Download the latest MacPorts which is an open-source utility to make it easy to download, install, and upgrade open-source software such as subversion, wget, etc. We will need it to set up the environment for VLC android compilation. (I downloaded “MacPorts-2.0.0-10.6-SnowLeopard.dmg”)
    • Look under “Mac OS X Package (.pkg) Installer” section for the dmg installable image for Snow Leopard.
    • Double-click on the downloaded “MacPorts-2.0.0-10.6-SnowLeopard.dmg” to mount the disk image.
    • It will show up on your desktop as a new drive “MacPorts-2.0.0”. Open the drive (if it doesn’t automatically open), launch the “MacPorts-2.0.0.pkg” file, and follow the installation wizard instructions.

    Periodically, you can run this command in a Terminal to update MacPorts and the programs which it has installed.

    sudo port -v selfupdate
    sudo port -v upgrade outdated

    To see the programs installed and managed by MacPorts, run this command in a Terminal:

    sudo port installed
  3. Open up a new Terminal and use MacPorts to install the following utilities:
    sudo port install wget
    sudo port install autoconf
    sudo port install libtool
    sudo port install pkgconfig
    sudo port install subversion

    The first installation, wget, will take a long time so just have patience.
    Note: After installing programs using MacPorts, you will want to re-start the Terminal before using these command line tools.

Install Subversion Eclipse Plugin (Subclipse)

Optionally, add support for subversion in Eclipse:

  1. Install the subversion JavaHL bindings which is required by the Eclipse subversion plugin.
    sudo port install subversion-javahlbindings
    • Updated Note: Macports’ latest subversion-javahlbindings 1.7.x works fine with Eclipse Juno.
    • Note: Macports’ recent upgrade of subversion-javahlbindings to version 1.7.1 (from 1.6.17) broke Subclipse compatibility with Eclipse Indigo. If you use Eclipse Indigo, you will want to install the JavaHL 1.6.x bindings from Collabnet Website instead.
  2. Run Eclipse.
  3. Go to Eclipse menu Help->Install New Software…
  4. Input “http://subclipse.tigris.org/update_1.8.x” into the “Work with” field and the table will be updated with installation packages available at that location. (You can check what is the latest subclipse here.)
  5. Check just the “Subclipse” package and click Next, Next, accept the license, Finish.
    • Note: If the first Next button freezes Eclipse with a message saying that it is “Calculating requirements…”, then it may be that one or more Eclipse update sites are unreachable. If you encounter this, you may need to force quit Eclipse (canceling doesn’t seem to unfreeze it). Restart Eclipse, repeat these steps, but uncheck the “Contact all update sites during install to find required software” before clicking on the first Next button.
  6. If the Security Warning dialog about the “unsigned content” appears, click Ok to accept.
  7. Click on “Restart Now” to restart Eclipse.

Download and Compile VLC

We will download and install VLC android according to the VideoLan website’s VLC Android Compile directions. I will repeat the relevant instructions below with my additional notes. Please double-check the instructions below against the VideoLan website because the VideoLan instructions are updated continually.

  1. Get the VLC source using Git. Run the following on a newly opened Terminal in the directory (ex: “~/projects”) where you want to download VLC android to:
    git clone git://git.videolan.org/vlc/vlc-android.git

    This operation will take a long time. By default, it will create a subdirectory called “vlc-android”. If you don’t like that, then add the custom subdirectory name as an additional argument to the end of the “git clone” command. Alternatively, you can always rename the “vlc-android” subdirectory afterwards.

  2. Configure 3rd party modules for android compilation:
    cd vlc-android/extras/contrib
    ./bootstrap -t arm-eabi -d android

    This step will create the following files: config.mak, distro.mak (softlink to src/Distributions/android.mak), Makefile (softlink to contrib.mak), toolchain.cmake. Also, the following directories are created: build (softlink to hosts/arm-eabi), build-src, hosts.

    • Hint: It looks like you can edit “distro.mak” to enable/disable 3rd party module compilation by editing the “all” target to include/exclude projects.
  3. Retrieve 3rd party modules from the internet (which uses the wget and subversion that we had installed with MacPorts) and compile them for Android. Under the same “vlc-android/extras/contrib” directory, run:
    make

    Some things to watch for:

    • With the VLC version I got, the make command failed with an error:
      RTSPServerSupportingHTTPStreaming.cpp:69: error: invalid conversion from 'long unsigned int*' to 'const time_t*'

      I fixed it by modifying the “./build-src/live/liveMedia/RTSPServerSupportingHTTPStreaming.cpp” file (you will need to chmod it first to make it modifiable) and inserting an explicit cast “(const time_t*)” in the call to gmtime: “gmtime((const time_t*)&sb.st_mtime)”.

    • The make will retrieve the 3rd party module source code under the “./build-src” subdirectory and will generate the library files under the “./hosts/arm-eabi/lib” subdirectory. The corresponding library headers can be found under the “./hosts/arm-eabi/include” subdirectory.
  4. Configure the main VLC codebase for Android compilation:
    • First before you do anything else, go back to the original root “vlc-android” git clone directory. The VideoLan website neglects to include this step. Assuming that you created “vlc-android” under your home directory, run these commands:
      cd ~/vlc-android
      ./bootstrap

      This step will create these files: ABOUT-NLS, aclocal.m4, config.h.in, configure, Makefile.in. And will create a directory, autom4te.cache, and add these files to the autotools directory: compile, config.guess, config.sub, depcomp, install-sh, ltmain.sh, missing. Additionally, the Makefile.in file is added to directories: bin, compat, doc, all subdirectories under libs, m4, modules (including most subdirectories of), share, src, test. Finally, directories m4 and po got other miscellaneous files.

    • Create our own build directory and prepare it to hold the compiled VLC classes:
      mkdir build
      cd build
      ../extras/package/android/configure.sh

      This step will create a bunch of files and directories under the “build” directory. The most important files are:

      • config.h – contains directives to customize the build; the variable CONFIGURE_LINE will reflect the enable/disable directives from configure.sh.
      • Makefile – builds the Android-compatible static .a library files for enabled modules

      Hint: Before running “../extras/package/android/configure.sh”, you can edit it to enable/disable modules. Search for “–enable” or “–disable” and adjust accordingly. When enabling/disabling 3rd party libraries, please make sure that your changes here matches the changes you made to “distro.mak” earlier.

  5. Compile VLC and configure Android JNI generation:
    • Run this command to compile the VLC source code (it will take a long time before completing).
      ./compile -k

      This program uses GNU libtool to compile the VLC source and prepare it to generate a shareable library (or dynamically-linked library). As a result, besides the standard object .o files and static library .a files, you will see .libs and .dep subdirectories and .la, .lo, and .Plo files required by libtool. Most of these files will be created under the build directory’s src and modules subdirectories.

    • Create the NDK makefile and build the VLC JNI library for Android by running these commands:
      cd ../extras/package/android
      VLC_BUILD_DIR=../../../build make

      Things to note:

      • Under the “vlc-android/extras/package/android/vlc-android” directory, you will see the following new subdirectories: bin, gen (contains auto-generated Android java sources like R.java), libs (contains libvlcjni.so which is the VLC shared library), and obj. In addition, you will see the following new files: local.properties, jni/Android.mk (NDK makefile) and jni/libvlcjni.h (declare VLC plugins). (Android.mk and libvlcjni.h should only contain the enabled modules matching your changes to “distro.mak” earlier.)
      • If you did not name your “build” directory as “vlc-android/build”, then you will need to adjust the value for VLC_BUILD_DIR in the command above accordingly. If you ran the above command with the wrong VLC_BUILD_DIR, run the following commands to cleanup before re-running the make again:
        make clean
        rm vlc-android/jni/Android.mk

        The “make clean” deletes the bin, libs, and obj subdirectories but neglects to delete jni/Android.mk which makes use of the VLC_BUILD_DIR variable.

Compile and Deploy the Android VLC Player

  1. Launch Eclipse.
  2. Create a new project by doing the following:
    • Select menu File->New->Project…
    • Select Android->Android Project. Click Next.
    • Click on “Create project from existing source”.
    • Press the Browse… button and locate the “vlc-android/extras/package/android/vlc-android” directory.
    • Update “Project name” field to “vlc-android” (or whatever you want). Press the Finish button.
  3. The new “vlc-android” project will be created and will appear under the Eclipse Package Explorer left-most pane. The Eclipse ADT plugin will automatically compile the newly-imported vlc-android project and prepare it for deployment. Hopefully you don’t see any errors.
  4. Deploy the VLC Player to an Android device:
    • Connect your Android device to your Mac. You can double-check that the Android device is recognized by opening up a Terminal and running the follow ADB command:
      adb devices

      You should see your Android device listed with a 12 alphanumeric characters long identifier.

    • Locate “vlc-android” project under the Eclipse Package Explorer pane.
    • Right-click on “vlc-android” project and select “Run As”->”1 Android Application”. Eclipse ADT will deploy the VLC Player to your Android device and launch it.
    • If you have more than one Android device connected or you have created an emulator (VLC Player cannot run under an emulator), you will need to configure Eclipse ADT to allow you to manually select the Android device to deploy to:
      • Right-click on “vlc-android” project and select “Run As”->”Run Configurations…”.
      • “Android Applications”->”vlc-android” should already be selected.
      • Click on Target tab and check the Manual radio button.
      • Hit Apply and Close buttons.

Using the Android VLC Player

  1. Before running the VLC Player, you will need to prepare some movies for it to play.
    • You can download some Android compatible movie trailers here. If you create your own sample movie files, I recommend making sure the video encoding, video resolution, audio encoding, audio sample rate are supported by your Android device.
    • Copy the video files to your SD card under a directory called “movies”. You can remove the SD card from the Android device and stick it into your computer to copy the movies over. Or you can use ADB to copy the video files to the Android device over USB like so:
      adb shell
      cd sdcard
      mkdir movies
      exit

      adb push movie1.mp4 /sdcard/movies
      adb push movie2.mp4 /sdcard/movies
      ...
    • Launch VLC Player on your Android device. You will get a notice that it is alpha software; just click ok.
    • You will get the main VLC page with the message “No Media Files”. Fix that by doing the following on the Android device:
      • Touch the menu button and select Preferences.
      • Tap on Directories, on “sdcard”, and on the checkbox to the left of “movies”.
      • Touch return three times to get back to the main VLC page.
      • A list containing the movies and their preview images should appear.
    • Select a movie to play it.

Modifying VLC Source and Re-compiling the Android VLC Player

If you wish to modify VLC source code without having to redo the long compilation from scratch, below are some hints. Suppose that you wish to rebuild after modifying the “vlc-android/modules/video_filter/rotate.c” file:

  1. Force the rebuild of the object files related to “rotate.c” by doing the following under the “vlc-android/build” directory:
    cd build
    find . -name "*rotate*.*" -print | xargs rm
    ./compile -k
    ./compile -k

    The “./compile -k” is run twice because the first time, the libtool will error out because the dependency file .Plo will be missing. However, libtool generates the missing .Plo file all the same. The second time will succeed. (For cases where the .Plo file is not required by libtool, the first run will succeed.)

  2. Rebuild the Android NDK JNI related files by doing the following:
    cd ../extras/package/android
    make clean
    VLC_BUILD_DIR=../../../build make
  3. In Eclipse, right-click on the “vlc-android” project and select Refresh.
    • Note:If the “vlc-android” project starts throwing a bunch of “Cannot resolve type” class errors, you will need to tell Eclipse that it is okay to rebuild class files which have been modified externally (by our script commands above). To do so, enable the ”Rebuild class files modified by others” option under menu “Eclipse->Preferences–>Java–>Compiler–>Building–>Output folder”.
  4. Use Eclipse to re-deploy VLC Player to your Android device.
    • Note: I have seen instances where the re-deploy does not update the VLC Player on the Android and there are no error messages from Eclipse. If I suspect that, then I will manually uninstall VLC Player (on Android, tap “Settings->Applications->Manage applications->VLC media player->Uninstall”) from the Android device and then do a fresh deployment from Eclipse. As a shortcut, you can do this by opening a Terminal and running the following commands:
      adb uninstall org.videolan.vlc.android
      cd vlc-android/extras/package/android/vlc-android/bin
      adb install vlc-android.apk

Tips for Developing and Debugging with Android

  • To run the ndk-build script directly, you can do the following:
    cd vlc-android/extras/package/android/vlc-android/jni
    $ANDROID_NDK/ndk-build -B V=1

    The “-B” flag indicates a rebuild and the “V=1” flag enables verbose output.

  • VLC Player and other applications (including your own) may output debug traces to the adb logger (called logcat). (Under native C code, use msg_Dbg and msg_Err statements. Under Java, use the android.util.Log class.) Under Elipse, you can display the logger debug traces in real-time by going to menu “Window->Show View->Other…->Android->LogCat”. (Note: Under Eclipse, the filter only works on the Message text field.) Alternatively, you can open up a Terminal and run “adb logcat”.
  • Check CPU usage on the Android by opening a Terminal and running “adb shell top -m 5”.
  • Show the library dependencies by opening a Terminal and running “otool -L libvlcjni.so”. (The otool utility is the Mac OS X equivalent of the Linux ldd or readelf utilities.)

That’s it. Hope that you have fun developing with Android.

4 Comments

Eclipse Indigo for Android Development on Mac OS X Snow Leopard

Mac OS X 1 Comment

eclipseI decided to install the latest version of Eclipse, Indigo, and configure it to do Android application development. My specific final target is to build the VLC Player for Android. Below are my notes for installing such an Eclipse configuration for Android development on a clean Mac OS X Snow Leopard system.

Note: These instructions also work for the latest Eclipse Juno version. Just replace references to Indigo with Juno.

Install Android SDK

  1. Download latest Android SDK (I downloaded “android-sdk_r12-mac_x86.zip”).
  2. Unzip and move the extracted “android-sdk-mac_x86” directory to “/Applications”, so you end up with “/Applications/android-sdk-mac_x86”.
  3. Add the following to the end of your bash environment configuration file “~/.profile”. (The tilde symbol ~ translates into your home directory “/Users/your_username”.)
    export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
    export ANDROID_SDK=/Applications/android-sdk-mac_x86
    export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools
    export NO_NEON=1

    Some details on the above:

    • Mac OS X Snow Leopard comes with the 64bit version of Java 1.6 installed by default. We are just setting the JAVA_HOME to point at it.
    • The PATH is optional but will make it easy for you to run the Android SDK Manager by typing “android” or the Android Debug Bridge by typing “adb” in the Terminal.
    • Set NO_NEON to prevent Android compilation from using the Neon CPU enhancements which are not supported on all Android devices (including the Emulator).
  4. Run the Android SDK Manager, by launching $ANDROID_SDK/tools/android, to install support for one or more Android OS platform versions. (It is mandatory that you install at least one OS platform version.)
    • Click on “Installed packages” to see what is installed by default, usually just the Android SDK Tool and Platform-tools.
    • Click on “Available packages”, expand “Android Repository”, and select the SDK Platform OS version that you want to develop for. For example, if you wish to do Honeycomb development (or your Android phone has Honeycomb), you can check “SDK Platform Android 3.0, API 11, revision 3”. You might wish to also get the samples by checking “Samples for SDK API 11, revision 1”.

    Optionally, while we have the Android SDK Manager opened, you can create an emulator by clicking on “Virtual devices”:

    • Click the “New…” button, name your emulator, select a platform OS version for the target, input a SD Card size like 32 or more, and hit the “Create AVD” button. The SD Card size is optional but some programs may fail to run if a SD Card is not present.
  5. Periodically, to update your installation, you may wish to go to “Installed packages” and click the “Update All…” button. This will return all updates (even for items not installed) which are applicable; you will need to select Reject for those items which you don’t want to install/update.

Install Android NDK

We will need the Android Native Development Kit (NDK) in order to compile the Android VLC JNI library:

  1. Download the latest Android NDK (I downloaded “android-ndk-r6-darwin-x86.tar.bz2”).
  2. Unzip and move the extracted “android-ndk-r6” directory to “/Applications”, so you end up with “/Applications/android-ndk-r6”.
  3. Edit “~/.profile” to add the following:
    export ANDROID_NDK=/Applications/android-ndk-r5b
    export PATH=$PATH:$ANDROID_NDK:$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin

    The PATH is optional but will make it easy for you to run “ndk-build” from a Terminal. Also, when compiling projects like VLC, the android prebuilt tool will be required to be in the path.

Install Eclipse

  1. Download the latest Eclipse.
    • Select “Mac OS X (Cocoa)” in the “Packages for” drop-down listbox at the top to filter for only Mac versions.
    • Find the Eclipse flavor you want. If you aren’t sure, I recommend getting “Eclipse IDE for Java Developers”. Click on the “Mac OS X 64 Bit” to the right to download. (I downloaded “eclipse-java-indigo-macosx-cocoa-x86_64.tar.gz”.)
  2. Unzip and copy the extracted “eclipse” directory to “/Applications”, so you will end up with “/Applications/eclipse”.
  3. Start Eclipse and select your workspace location. (If you select an old location which was used by an older version of Eclipse, make sure to delete the “.metadata” sub-directory there first; otherwise, your new Eclipse will display old plug-ins and IDE modes which it may not have installed.)

Change How Eclipse Handles Search Results

In the recent versions of Eclipse, the default behavior for search is to reuse the editor. This default behavior can be annoying because it prevents you from being able to simultaneously view more than one search result. Opening a new search result would reuse the editor tab and cause the previous search result to become unavailable. To configure Eclipse to open each search result in a new editor tab, do the following:

  1. Go to menu “Eclipse->Preferences->General->Search”.
  2. Uncheck the “Reuse editors to show matches” option.

Install Android Eclipse Plugin (ADT)

Add the ADT to Eclipse:

  1. Run Eclipse.
  2. Select Help->Install New Software…
  3. Input “https://dl-ssl.google.com/android/eclipse/” into the “Work with:” field. Hit Enter. The table below should populate automatically. (You can use the optional Add button if you want to bookmark this URL.)
  4. In the table, expand “Developer Tools” to see what it contains.
  5. Check the “Developer Tools” box to select all. (If you want just the minimum, check only “Android Development Tools”.)
  6. Click Next, Next, select “I accept the terms of the license agreements” radio button, and click Finish.
  7. If the Security Warning dialog about the “unsigned content” appears, click Ok to accept.
  8. Click on “Restart Now” to restart Eclipse.

Configure the ADT:

  1. Under Eclipse, go to menu Eclipse->Preferences.
  2. Select Android.
  3. In the “SDK Location”, browse to your android install directory (directory pointed at by $ANDROID_SDK or “/Applications/android-sdk-mac_x86”).
  4. Hit Apply and you should see the Android platform versions you installed earlier populate the table.
  5. Hit Ok to close the dialog.

Install Eclipse IDEs for PHP and Javascript

Optionally, add the Javascript Development Tool (JDT):

  1. Go to Eclipse menu Help->Install New Software…
  2. Click on the dropdown arrow for the “Work with:” box and select “Indigo – http://download.eclipse.org/releases/indigo”. (If you don’t see this entry, just type in the URL manually.) The table will populate with a bunch of Indigo-compatible plugins.
  3. Type “javascript” into the “type filter text” field to show only the Javascript related plugins.
  4. Check the “JavaScript Development Tools” (for example, under “Programming Languages”) and click Next, Next, accept the license, Finish.
  5. Click on “Restart Now” to restart Eclipse.

Optionally, add the PHP Development Tool (PDT) by repeating the steps above, filtering on “PHP” instead, and selecting “PHP Development Tools” for installation.

Install Subversion Eclipse Plugin (Subclipse) and Compile Android VLC Player

If interested, see the next post for instructions on installing the Subversion Eclipse Plugin (Subclipse) and compiling the VLC Player for Android.

1 Comment

Xcode 4 with External Static Library for iPhone Development

Mac OS X 16 Comments

xcodeI upgraded to the latest Xcode 4 and had a tough time using it as things have changed quite a bit. (I’m not too familiar with Xcode 3 either so that didn’t help.) I also needed to make and include a static library (Live555) for the iPhone application that I am building. Because Xcode 4 is so new, there weren’t a lot of resources out on the internet. I finally got my app working with the static library and wanted to post some hints here. Hopefully this post will help those who are also having problems getting up to speed with Xcode 4.

Adding a Framework or Static Library File (with .a extension)

  1. Click on the folder icon under the giant top-left Run icon to “Show the Project navigator”
  2. Click on the Project name right underneath
  3. Click on the project name under “TARGETS”
  4. Click on “Build Phases” and then open up “Link Binary With Libraries” section
  5. Click on the plus button to add a Framework such as “AVFoundation.framework”.
    • If you want to add an external library, click on “Add Other…” and find your library file
  6. Doing the above will update the “Library Search Paths” setting automatically with the path to your library file. You can see what was set by doing the following:
    • Click on “Build Settings” (right before “Build Phases”)
    • Expand “Search Paths” and you should see “Library Search Paths”
  7. Most likely, you will need to use corresponding header files for your library file. To get this to work, you must add the header include path to “Header Search Paths” (if you use: #include <header.h>) and/or “User Header Search Paths” (if you use: #include “header.h”). Alternatively, if you set “Always Search User Paths” (also under “Search Paths” section) to “Yes”, then you just need to set “User Header Search Paths” for both include methods to work.
    • Click on “Build Settings” (right before “Build Phases”)
    • Click on “All” and scroll down to “Search Paths”
    • Double-click on the blank entry area to the right of “Header Search Paths” and/or “User Header Search Paths” to open up a dialog window.
      • Click the plus button and a checkbox will be added under “Recursive”. You can check the “Recursive” checkbox if you want Xcode to look into subdirectories also.
      • Double-click in the entry area to the right of the newly-added checkbox and input the path
    • You can then click on “Basic” and now “Header Search Paths” and/or “User Header Search Paths” will appear since they are no longer empty.

Building with an External Static Library File

  • The Xcode 4 SDK has been updated so make sure to update the sysroot directory in your Makefile to be “/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk”.
  • When compiling the library, if you see this error “ld: file not found: /usr/lib/system/libcache.dylib for architecture armv7”, then your linker command is using “–sysroot” which doesn’t work in Xcode 4. Instead, change the linker command to use “-isysroot”. (Note: This only applies to the linker command. The compile commands must continue to use “–sysroot”. See here for more details.)
  • When building the Xcode project with your library, if you see this error “file was built for archive which is not the architecture being linked (armv6)”, then the library you are linking to does not support armv6. In my case, I built the library using the “-arch armv7” so the resulting library did not support armv6. (I haven’t figured out how to compile a library for both armv6 and armv7 yet.) I had to force Xcode 4 to build only for armv7 to solve this error:
    1. Show the Project navigator
    2. Click on the Project name right underneath
    3. Click on the project name under “PROJECT”
    4. Expand the “Architectures” section (first section) and select “Optimized (armv7)” for the “Architectures” setting. (The default setting was “Standard (armv6 armv7)”.)

Using the Integrated (nice!) Interface Builder

  1. Show the Project navigator and click once on the project’s MainWindow.xib or Controller.xib file. The MainWindow.xib is the parent of the Controller.xib. You will want to put your UI components into Controller.xib.
  2. The Interface Builder will appear in the right content area.
  3. Show the utility pane by going to menu “View->Utilities->Show Utilities”. This pane is very useful and I leave it open all the time.
  4. To add a class which has UI hooks (IBOutlet and IBAction) to the Interface Builder:
    • Click on Controller.xib to show the Interface Builder. (Go ahead and add your buttons, text fields, sliders, etc., if you haven’t already done so.)
    • Go to menu “View->Utilities->Object Library”.
    • In the bottom-right of the Utilities pane, scroll down to “Object” and drag-n-drop it onto the Interface Builder content area. The Object will appear on the Interface Builder’s left vertical dock.
  5. Tie the IBOutlets/IBActions to the UI Components:
    • Select the Object in the dock and go to menu “View->Utilities->Identity Inspector”.
    • At the top of the Utilities pane, under the “Custom Class” section, hit the drop down to change “NSObject” to your custom class.
    • Leave the Object in the dock selected and go to menu “View->Utilities->Connections Inspector”.
    • At the top of the Utilities pane, click on the circle to the right of your Outlet or Receive Action and drag to the UI component you want to attach to. For Receive Action, you will be prompted to select the action, such as “Touch Down”.
  6. If you have added IBOutlet/IBAction hooks to your Controller class, do not add a custom Object to Controller.xib and change it to be your Controller class. Instead, use the pre-defined “File Owner” object in Controller.xib which is your Controller class. If you use your own custom Object instead of “File Owner” object, your iPhone application may crash.

Compiling the Live555 Streaming Media Library

For those interested, I had to make the following changes to compile the Live555 Streaming Media Library. Before running “./genMakefiles iphoneos”, update these two files:

  • Update the “config.iphoneos” file by adding one line to create a common variable, SYSROOT_DIR, and updating the compile and linker commands to use it:
    SYSROOT_DIR = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
    COMPILE_OPTS = $(INCLUDES) -I. $(EXTRA_LDFLAGS) -DBSD=1 -O2 -DSOCKLEN_T=socklen_t -DHAVE_SOCKADDR_LEN=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fPIC -arch armv7 --sysroot=$(SYSROOT_DIR)
    LINK_OPTS = -L. -arch armv7 -isysroot=$(SYSROOT_DIR)
  • Compiling the Live555 test executable programs would cause linker errors. To avoid these errors, update the “Makefile.tail” by commenting out these lines with the # character:
    #TESTPROGS_DIR = testProgs
    #MEDIA_SERVER_DIR = mediaServer

    all:
    ...
    #       cd $(TESTPROGS_DIR) ; $(MAKE)
    #       cd $(MEDIA_SERVER_DIR) ; $(MAKE)

    clean:
    ...
    #       cd $(TESTPROGS_DIR) ; $(MAKE) clean
    #       cd $(MEDIA_SERVER_DIR) ; $(MAKE) clean

Good luck with your iPhone development!

16 Comments

« Previous Entries Next Entries »