Friday, November 25, 2005

OS X x86 Native Install -- Tutorial

OS X on a PC? oh Yes, and its about goddam time =)

So you've heard the hype? I am about two months behind the curve, but thats good because it allowed all the really hardcore geeks to figure everything out for me. OS X for the x86 processor achitecture is far from perfect, but what do you expect?

-Doug the Head, Snatch

Prerequisites

Regardless of it's limitations, the actual OS runs great. It's the programs compiled for the Power PC(PPC) architecture that run slowly or not at all. If you are thinking about turning your PC into a Mac, then there are some things you MUST consider before taking the leap. There are some hardware limitations which have been heavily (and are continually) documented on osx86project.org (the first of many resources you will need). I suggest you take a look at their comiled list after reading through my "short" listof prerequisites.
  1. CPU - The first and most important hardware requirement is the processor. It must support at the very least SSE2 and/or SSE3. Most Intel processors have support, but here is a little tool to check if your not sure: CPU-Z. Launch the application in Windows. Click on the "CPU" tab. Verify that the "Instructions" box contains either "SSE2" or "SSE3." If it does, your good to go! SSE3 processors run best, and if you only have SSE2 (like me) then you will find a significant performance loss. OS X runs great even if you don't have SSE3, but requires additional patching and only some PPC applications run.
  2. GPU - Most NVidia and ATI cards are reported to work, but the most supported hardware is of the Intel variety. Probably because Apple is working with Intel to make the change over to an x86 architecture. I have an NVidia 5500LE card and it works fine after a little dickering. I will go into this portion of the installation process later in the article.
  3. Sound - Sound Cards seem to be the least supported by OS X x86 but I'm sure there will be some homegrown drivers being congealed soon enough. If your motherboard has AC'97 built in, it will work, other than that, I just don't know. Again, this will be discussed in more detail further on in the article.
  4. At least 6 GB of free hard drive space.
  5. Finally, you must have a USB keyboard and mouse to use Mac OS

Before moving on with this tutorial, there are a couple of things to mention. Contrary to popular belief, pirating software is illegal, and I don't support it. I own a Mac and I feel that if I am able to get OS X running on my pc just for the hell of it, I am entitled to a bit of harmless testing. You have to remember that this will be a VERY buggy system, without upgrade capability (*wink*) for the OS, as well as limited software compatibility. This process is not for the weak hearted or technically challenged. It will require quite a bit of the following: DOS and UNIX commands, disk partitioning, low-level .kext (OS X driver files) editing, and troubleshooting. I will also note that there are multipule steps in the process that can totally fuck up your computer, so before you start, make sure if you happen to destroy your Windows installlation you havent lost anything valuable. If you think your up to the challenge, grab a cup of coffee and get ready to dive in.

Part one: Downloads

To get started you will need to download several things to get started. The main download is the OS X disk image. You can find this file by searching for "tiger-x86" on your favorite torrent search site. Please remember that downloading pirated software is illegal and I only downloaded this file for educational purposes. If you do install please remember that the only reason you can is because of all the hard work done by the good people at Apple. If you are really going to use something, you should buy it.

The disk image contained in this file is about 6 GB once it is extracted using WinRAR. It may take a while to uncompress. Remember, you are turning a 1.3 GB file into 6 GB worth of information. Once extracted, find the file named "tiger-x86-flat.img" and move it to the root of your hard drive, ie c:\tiger-x86-flat.img. This is just so you can easily access this file for future steps in the installation process.

Having done that, you are now ready to move on and Partition your hard drive to create space for your new operating system.

Part two: partitioning

There are several ways to go about this step, but depending on your hardware the decision will be made for you. If you dont know much about partitioning, check out wikipedia for an explanation. I used Partition Magic to manipulate my HD's partitions, but you can use whatever you are comfortable with. Paritioning is dangerous if you dont know what you're doing, so I suggest backing up any important Data before proceeding with this step. If your not careful you can erase your entire HD, so beware =)

I opted for dedicating a seperate HD for OS X, but you can still install if you have only one HD. If you are going to use a single HD for both Windows and OS X then you must resize your Windows partition to create space for OS X. I recomend shrinking your Windows partition until you have at least 20 GB of unused space for OS X. If you are going to use a seperate HD, you must delete the current partitions on that HD and make sure there are NO extended partitions or anything else littering the MBR (master boot record) of that HD, or you will not be able to install OS X.

Having done one of the two options above, reboot your computer just to be safe.

Once rebooted, go to the start menu and select "run...", type "cmd" and hit enter. Now you are in the command prompt, navigate to c:\ and type the command "diskpart". This is DOS's disk partition utility and we are going to use it to create two partitions for OS X's file system "HFS+". Type "list disk" to see all the hard drives on you machine. Now you have to select the disk you are going to create the new partitions on by typing "select disk" and then the # of the disk out putted by "list disk". If you have one hard drive the disk # will be "0", so the command would be "select disk 0". DOS will now tell you that you have selected the disk: "Disk 0 is now the selected disk" or whichever disk you have selected to install OS X.

We are now going to create two partitions, the first one for the OS X disk image. Type this command to create the first partition:

create partition primary size=6660 id=af

Wait a few seconds and then type the following to create a second partition to make the remainder of the unused space accessable to your OS X install:

create partition primary id=af

Wait a few seconds. Once the command line comes back, type "list partition" to verify the two partitions have been created. Close the command line and reboot your computer just to make sure the MBR is ok.

Part three: copying the disk image

Once your computer has restarted, it is time to copy the downloaded disk image onto the first 7 GB partition you created in the last step. Download dd for windows, unzip and copy the files to the root directory of your windows partition, or c:\, where you have put your copy of the disk image "tiger-x86-flat.img". Click on the start button and select "Run...", type "cmd" and hit enter. You are now back at the command line of DOS. Navigate to "c:\" by typing "cd.." a few times or "cd c:". We are now going to use dd to raw write the disk image to the 7 GB partition you created in the last step.

Type "diskpart" to start DOS's partition program, then type "list disk" and then "select disk 0" or "select disk 1" to access the disk you partitioned in the last step. Type "list partition" to figure out which partition you need to tell dd to copy the disk image to. Type "exit" to quit diskpart, then type the following into the command line:

dd if=c:tiger-x86-flat.img of=\\?\Device\Harddisk0\Partition2 bs=512 skip=63

Substitute "Harddisk0\Partition2" to reflect the info you just got from diskpart. For me, my second HD, the one I dedicated to OS X, was "Disk0", and the 7 GB partition was "Partition1". After you have entered in this command correctly, the screen will have some info about the program dd and it will appear to be doing nothing, for a long time. Just wait for dd to do its thing, copying over 6 GB of info from a disk image can take a while. Once the program is done it will return to the command line "c:\" with some info above saying "#big number in #big number out". You can now close the command prompt.

part four: setting up your boot configuration

Now that you have the disk image copied over, you will need to tell your computer that there is a new OS that it can boot to. The easiest way to do this is by downloading the file chain0, extracting it, and copying it to the root directory of your windows disk, or "c:\" where you have put dd and "tiger-x86-flat.img". Now right click on "My Computer" and select "properties". Go to the "Advanced" tab and under "Startup and Recovery" click on "Settings". Click the "edit" button to manually edit your "boot.ini" file, which tells your computer how to start up windows. The file will open in Notepad, and you will add the following on to the bottom of the file:

C:\chain0="Mac OS X"

Save the file and close Notepad. Click "ok", "ok", "ok", until you are back to your desktop. Go to the start button, select "Run..." and type "msconfig". Go to the "Boot.ini" tab and click "Check all Boot Paths" to make sure your computer will still boot windows correctly. If all is good, close msconfig and reboot your computer.

part five: troubleshooting

You now have OS X on your PC! This is the point at which you should hold your breath and hope all your hardware is compatable. There are many different options once you reach this point, but I will describe what I did, just for the sake of my carpel tunnel wrists. If you have done everything correctly, once your computer reboots, a menu should come up giving you two options -> "Windows" or "Mac OS X". Select "Mac OS X" and cross your fingers.

If your computer gives you an error like "chain booting error" or the menu doesn't come up giving you the option of booting OS X, then there is something wrong with the setup of your HD and "chain0". I found that the HD you have OS X on must be disk0 or the "chain0" boot file wont work, so if you have more than one HD, here is an option you can explore. You can change this several ways. First, I would suggest going into your bios and changing the order of the disks on your IDE/ATA/SATA bus. If that doesnt work, boot in Windows (hopefully it still works =), then open the command line and run "diskpart". Select the disk and partition you created for OS X and type "active". Exit the command line and reboot your computer. This will set your OS X partition as the active partition on that HD.

If OS X starts, but hangs in the middle of loading, or your computer reboots while trying to load there are several options you can explore. First, I would suggest disabling all the unnecessary serial ports/other bullshit on your motherboard, and enabling the onboard sound instead of using your sound card.

You can also try using different boot options to start OS X. To boot in safe mode, type "-x", to boot using default settings/drivers, type "-F". I had to use "-F" to get OS X to boot. There are a few other options that might help, just type "?" to see all the different commands. If that doesnt work, try taking out all your PCI cards one at a time until OS X boots.

Once OS X has booted, go to the applications folder -> utilities and run the diskutility app. Go ahead and format the second partition you made in part 4. Now, either you can use this space to extend your current OS X installation, or if you have OS X on the same HD as Windows, you can "Restore" the current install of OS X into the second partition, then change the first partition back into Windows file format.....its up to you, but now you have OS X on your PC =) If OS X doesn't recognize the second partition, you may have to install Darwin to get the correct file system.

To do this, download Darwin and burn the install CD, preferrably using OS X. Restart the PC and boot up from the Darwin Installer CD. I had to type "-F" to boot using all the default settings/drivers. Follow the instructions and make sure that you select the second partition you made in part 4. When Darwin is done installing a command prompt appears. Enter "reboot" to restart your PC with the CD removed.

Part six: Tweaks and Fixes

There are lots of different tweaks you can make to get OS X running to its fullest potential. Rather than type them all out, I will give credit where credit is due and simply provide links to various tutorials that cover all the relevant topics:

Video , Sound, and beyond -> http://wiki.osx86project.org/wiki/index.php/Tips_And_Tricks NVidia fixxes -> http://macvidia.plusmediamusic.com

part seven: The end

Well, hopefully this worked for you =) OS X on a x86 is a little dissapointing for me, mainly because I only have SSE2, but it is still pretty damn cool. I had a lot of fun getting this to work and I hope you have too. The original tutorial that i used is here and I pretty much copied this tutorial from there. I of course added in some of the solutions that I had to figure out, but I found this tutorial to be the easiest to follow. There are other methods for installing OS X on a PC, such as VMware. Regardless, good luck and send me an email if you have any questions =)

Thursday, November 24, 2005

new gyreWire design iteration

Haven't posted in a while, but here it is: gyrewire.com The new hotness =) If you have any comments, please email me at feedthefire@gmail.com...

Stay tuned (riiiiiiiiiight....like anyone is reading this shit), anyway I am going to be posting some actual knowledge for you all to dig on. I got OS X running on my PC (not exactly legal), figured out a nice PHP/Flsah integration technique to share, as well as a bunch of neat JavaScript snippits you need to have in your library....Another thing I found is a sweetimo "how to" about a dual monitor setup where you can use the sme keyboard and mouse for a mac and a pc at the same time

Until next time....

Cody