{"id":44,"date":"2012-12-20T03:15:18","date_gmt":"2012-12-20T03:15:18","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=44"},"modified":"2013-07-12T02:16:02","modified_gmt":"2013-07-12T02:16:02","slug":"how-to-create-a-bootable-os-x-mountain-lion-10-8-usb-drive-from-linux","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/how-to-create-a-bootable-os-x-mountain-lion-10-8-usb-drive-from-linux\/","title":{"rendered":"How to create a bootable OS X Mountain Lion (10.8) USB drive from Linux"},"content":{"rendered":"<p>Found this from <a href=\"http:\/\/blog.natetron.net\/2012\/08\/how-to-create-bootable-os-x-mountain.html\" target=\"_blank\">here<\/a>, since it was useful I decided to paste it here.<\/p>\n<p>I saw a few guides on how to make a bootable OS X flash drive, but not many on how to do it without already having access to an OS X machine. Here are my ugly notes on creating\u00a0a bootable OS X Mountain Lion (10.8)USB drive from\/with Linux.<\/p>\n<p>The copy of OS X 10.8 (Mountain Lion) I downloaded was in the form of a file named &#8220;InstallESD.dmg&#8221;. First, you&#8217;ll need to open it. You will need p7zip installed. If you try to dmg2img this file, you won&#8217;t get very far, so just extract it with 7-zip:<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\">7z x InstallESD.dmg<\/span><\/p>\n<p>The unrolled dmg file I found was 4348218934 bytes in size and had an md5sum of\u00a08b4869920cd740414fe6b7e3f0b1be3e.\u00a0Inside was another file with the same name (although it is slightly smaller) which is the actual install image. The internal dmg file (the one we really want) was 4333438336 bytes in size and had an md5sum of 68fd407bb74e4a2dd1913ce8bae80fc4. It must be converted prior to mounting, and for this you will need dmg2img installed.<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\">cd InstallMacOSX.pkg\u00a0<\/span><br \/>\n<span style=\"font-family: Courier New, Courier, monospace;\">dmg2img InstallESD.dmg\u00a0<\/span><\/p>\n<p>The resulting img file was only 137322496 in bytes and had an md5sum of 05b5788f10f7300c457e2aed735eb83a. Now find the offset to properly mount the install partition in the resulting file.<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\">hexdump -C InstallESD.img | grep &#8220;48 2b 00 04&#8221;<\/span><br \/>\n<span style=\"font-family: Courier New, Courier, monospace;\">00008400 \u00a048 2b 00 04 80 00 01 00 \u00a031 30 2e 30 00 00 00 00 \u00a0|H+&#8230;&#8230;10.0&#8230;.|<\/span><\/p>\n<div><\/div>\n<p>I got &#8220;00008400&#8221; which is hex for\u00a033792 in decimal:<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\">$echo $((0x00008400))<\/span><br \/>\n<span style=\"font-family: Courier New, Courier, monospace;\">33792<\/span><\/p>\n<p>We need to subtract 1024 from this number to find the target offset:<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\">$echo &#8216;33792-1024&#8217;|bc<\/span><br \/>\n<span style=\"font-family: Courier New, Courier, monospace;\">32768<\/span><\/p>\n<p>Now make the loop device:<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\">losetup -o 32768 \/dev\/loop0 \/path\/to\/InstallMacOSX.pkg\/InstallESD.img<\/span><\/p>\n<p>And finally, mount it:<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\">mount -t hfsplus \/dev\/loop0 \/mnt\/tmp\/or\/wherever\/you\/want<\/span><\/p>\n<p>Next, I re-initialized an 8GB USB flash drive with an MSDOS partition table and created an HFS+ partition with gparted after installing these packages:\u00a0hfsprogs hfsplus hfsutils.<\/p>\n<p>Next, mount the HFS+ USB device R\/W and cd to the \/mount\/point\/of\/loop\/device and copy the contents of the mounted image:<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\">tar cvf &#8211; * | tar xvf &#8211; -C \/mount\/point\/to\/hfs\/usb\/drive<\/span><\/p>\n<p>Sync, unmount, insert USB drive into the Mac and power it on while holding down the OPTION key.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Found this from here, since it was useful I decided to paste it here. I saw a few guides on how to make a bootable OS X flash drive, but not many on how to do it without already having &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/how-to-create-a-bootable-os-x-mountain-lion-10-8-usb-drive-from-linux\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,25],"tags":[26,53,7,60,274,27,59,58],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-linux","category-os-x","tag-bootable-drive","tag-bootable-thumb-drive","tag-linux-2","tag-mountain-lion","tag-os-x","tag-os-x-mountain-lion","tag-thumb-drive","tag-usb-drive"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":5,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":46,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/44\/revisions\/46"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}