Mac OS X: Burining disc

There are many ways of burning a disc on Mac OS X. This is one of the way.

1. Insert an empty DVD/CD into the DVD tray/drive and wait till it mounts. Once it is mounted you would see an icon with name “Untitled DVD“. Drag and drop the contents to be burned into the icon.


2. Go to Finder Menu and select File -> Burn “Untitled DVD” …

3. Finder will, throw up a dialog asking for Disc Name and Burning Speed. For Disc Name give an appropriate name and for Burning Speed keep the default value or set the maximum speed available. Click the “Burn” button.


4. A progress dialog will be shown for the burn process.


5. DVD/CD icon will be replaced by the locked folder icon.

1. If you cancel while the disc is being burned, the CD/DVD will be incomplete and unreliable. You should not use it.


Mountain Lion Signing packages

The intention of this blog is to guide you through signing of the packages(pkg) or installer for Mac OS X 10.8 (Mountain Lion). There are different ways to make installer for Macintosh and one of the most preferred way is to use PackageMaker. PackageMaker is an application released by Apple for making installer. It’s pretty easy to do basic things with PackageMaker but customized things aren’t very easy to do. The problem being there is very little useful documentation from Apple.

Coming back to task at hand, We need to sign our package using Apple’s Developer ID Installer Certificate for the Gatekeeper to allow the installer to run. There are two simple steps.

Step 1: Create a normal (unsigned) installer using either the UI or the command-line version of PackageMaker

Step 2: Use productsign to sign the Package

Usage: productsign [options] –sign identity input-product-path output-product-path

This would work as long as the installer is of PKG format (flat). Signing of MPKG format is not supported.

Properly Signed Installer

Properly Signed Installer

Avoid using any of these methods.

1. Signing the Package using PackageMaker’s UI

2. Signing the Package using PackageMaker’s command line tool

Incorrectly signed installer

Incorrectly signed installer

If you compare the incorrectly signed installer image with the correctly signed installer image, you would find one difference. Incorrectly signed installer does not have Developer ID Certification Authority certificate. Without this certificate the Gatekeeper cannot verify the signed installer and hence rejects it. The problem is with PackageMaker, it doesn’t add the Developer ID Certification Authority certificate while signing the installer.

Splitting and joining files in Macintosh and Linux

There are lots of tools available on PC (Windows) for splitting and joining files. There are very few available on Macintosh and Linux. But on Macintosh and Linux we don’t really need a separate tool for splitting and joining files the OS comes with one for us.

Splitting and joining files are pretty straight forward. There are two simple command line tools to do it. In this entire exercise we will be using only 3 command line tools.

1. Change Directory.

cd – change the current working directory to a specific Folder.
cd [-L | -P] [directory]

2. Splitting the File.

split — split a file into pieces
split [-a suffix_length] [-b byte_count[k|m]] [-l line_count]
[-p pattern] [file [name]]

3. Joining the File.

cat — concatenate and print files
cat [-benstuv] [file …]

Lets get down to business and start splitting the file.

File Split
I didn’t have any big file to try the commands on. So I compressed Google Chrome application.

Created Google Chrome Zip File

Get into the folder containing the huge file using cd (change directory) command

cd path/to/the/folder/containing/file
split -b 50m “Google” ChromePieces

“Google” -> Name of the file to be split
ChromePieces -> Prefix of output file name.
-b -> Create smaller files byte_count bytes in length.
50 ->byte_count value.
m -> indicates megabyte pieces. k can be used instead for kilo-byte pieces

Used “split” command to split the file

The zip file size was 93.1 MB. So it ended up creating two files. As can be seen from the image above.

Joining Files

Used “cat” to join the files

cat ChromePieces* >

We are joining all the files that have prefix file name “ChromePieces” and the resultant file will be created as

A new ( file is created.

Unzipped the newly created zip file.

You can unzip the file and Google Chrome application extracted would work as normal. Split and cat can be used on most of the files. I have tried it on binaries(Application & Installers), Audio and Video Files, Text files.

Mountain Lion Gatekeeper

This is the first in a series of 3 posts documenting the working of Gatekeeper and signing of the plug-ins and the installers.

Gatekeeper is Apple’s security feature that is designed to protect Mac OS X users from malicious software.

Gatekeeper will be able to run in three modes:
1. Mac App Store: The default mode, a stricter mode in which users will only be able to install applications downloaded from the Mac App Store.
2. Mac App Store and identified developers: Relaxed mode that allows users to install applications downloaded from the Mac App Store or identified developers (Applications signed using certificate generated by Apple.)
3. Anywhere: Any application can be installed.

Gatekeeper options

While option 1 is the safest, option 3 is like being back on Lion or any other previous version of Macintosh. Option 2 seems like a good middle path which quite a few developers will take.

Important points to remember regarding Gatekeeper:
1. The Gatekeeper does not check or restrict Plug-ins, Frameworks etc.
2. Any software already installed—and that has been run at least once—will continue to run even after Gatekeeper is enabled. Gatekeeper checks on first launch of an application.
3. Gatekeeper uses OCSP (Online Certificate Status Protocol) to verify the certificate, OCSP talks to servers over the Internet.
4. Gatekeeper validates/checks all the installer.

For more information on Gatekeeper behaviour refer: Macworld article and tidbits article

I did few experiments to understand the Gatekeeper better.

Check 1: Downloaded a pkg installer (unsigned) on 10.6 and ran it on 10.8 from a pen drive
I Downloaded a pkg installer which doesn’t work (not signed) on 10.8 (Mountain Lion) on 10.6 (Snow Leopard) using Google Chrome and transferred it to a pen drive next day and tried installing it. The Gatekeeper detected that the pkg was not signed. The behavior was same when I downloaded the installer from a mail server.

Downloaded on Snow Leopard but Gatekeeper detected it.

Check 2: Downloaded a pkg installer (unsigned) on 10.8
I Downloaded an pkg installer which doesn’t work (not signed) on 10.8 on 10.8 and tried installing it again Gatekeeper was up to the task. The behavior was same when I downloaded the installer from a mail server.

Check 3: Downloaded a signed pkg installer on a fresh 10.8 machine without internet
Basically this machine had Mountain Lion Preview 4 and my signed installer was not used on this machine. I pulled out the LAN cable (WiFi was turned off) and I tried to install my package using the pkg installer. Gatekeeper allowed the installer to run without any warning. Looks like OCSP (Online Certificate Status Protocol) is not the only check Gatekeeper performs. Good news is that Gatekeeper doesn’t need the machine to be connected to internet for it to verify the certificates. The behavior was same when I downloaded the installer from a mail server.

Check 4: Downloaded an application (unsigned) on 10.6 and ran it on 10.8 from a pen drive
The application didn’t have a pkg installer. I just had to drag and drop the app into “Applications” folder. Copy worked fine but when I tried to launch the application, Gatekeeper kicked in. I used an older version of TextWrangler to generate the issue.

Check 5: Downloaded an application (unsigned) on 10.8
Same as Check 4. Gatekeeper wouldn’t allow me run the application. I used an older version of TextWrangler to generate the issue.

Check 4 and 5

Check 6: Downloaded a signed application on a fresh 10.8 machine without internet
Gatekeeper verified and allowed the application to launch.

Gatekeepers doesn’t quite meets my expectation. I would be very happy if it starts validating frameworks, plug-ins and command line tools that the user can download from internet. There are already improvements in Gatekeeper implementation in Mountain Lion GM over Mountain Lion Preview 3. But it is a good start none the less.

HDFC Alerts (R) Account Attempt Error User Login

I recently got this mail. It turned out to be fake but it almost caught be unguarded. This is the contents of the mail.


Dear Esteemed Customer,

Your Account has been flagged for Security issues within the last 24 hours. You are hereby mandated to confirm with our customer care your Online Login Information to quickly access this error. To ensure Smooth Banking Operation, You are also informed to correctly fill in your Secure Online Questions and Answers which you had already updated with our Bank upon your Registration.

Please click the link below to verify your account with us.

Click Here To Resolve The Issue

This Notice is strictly for Third Party Account Holders Only.

Thank You
Customers Service

Please endeavour To Open the Your Account Update Link using Internet Explorer 5.5 or Above .

Thank you for using HDFC Bank Ltd !
Copyright© 2010 – HDFC Bank Ltd. All rights reserved.

Information on protecting yourself from fraud, please review the Security Tips in our Security Center.

This is actually a form of phishing.

Phishing is the criminally fraudulent process of attempting to acquire sensitive information such as usernames, passwords and credit card details by masquerading as a trustworthy entity in an electronic communication.

Quoted from Wikipedia.

There were four things which saved me.

1. The mail went to spam section. Credit goes to Google mail(Gmail) for this because unlike Yahoo mail it doesn’t put useful mails into spam. So I trusted Google mail to do its job.

2. On checking the sender email id, I realized it was from commercial Internet domain name (.com) instead of it being .net. All the mails from HDFC bank comes on domain ending with .net. This mail was from “” instead of net“.

3. Importantly I had never received this message despite trying to logging in with wrong passwords, Accidentally of course.

4. The most important point, the URL didn’t work. It was brought down for performing illegal action.

The fourth point also meant I could not see the html file, which also meant the end of the investigation. May be it’s a good thing that I don’t use Windows OS and there is no risk of using Internet Explorer, since the mail requested me to use IE. Somehow using Ubuntu and Macintosh(without Safari) makes me feel a little safer.

If you ever come across such mails be careful, because banks normally don’t ask you to login to Update your Account.

Please make time to go through the link, it contains a list of other spam mails.

Merry Christmas and Happy Holidays!

AppleScript execution error: No user interaction allowed. (-1713)

AppleScript is a powerful tool. What I love the most is the ease with which you can do most of the work. Most of my AppleScripts either ran directly from the AppleScript Editor or ran as an application.

Recently I had to write an AppleScript to run from an installer created using Izpack and unfortunately IzPack treated AppleScript files as binary file. So I had to write a shell script to start my AppleScript.

I basically had a shell script which would in-turn call my AppleScript

osascript SOURCE_LOCATION/myScript.scpt

When my script tried to show a dialog I got the following error “myScript.scpt: execution error: No user interaction allowed. (-1713)” . My script would run correctly when I run it from AppleScript Editor but when I would run the script from terminal I had the problem.

On searching I realized that AppleScript doesn’t allow User-Interaction if it is run from Terminal and writing a shell script to run AppleScript was equivalent to running it from Terminal. There were two solutions to this problem.

1. I convert my script into an application.
This would solve the problem in most cases, but in my case I wanted the installer to wait for my script to complete.

2. I wrote another script to fix the issue.

on run {sourcefile}
tell application “AppleScript Runner”
do script sourcefile
end tell
end run

I called it “AppleScriptRunner.scpt” and modified my shell script to

osascript SOURCE_LOCATION/AppleScriptRunner.scpt OURCE_LOCATION/myScript.scpt

This time the error message was not shown. AppleScript Runner can be found at “/System/Library/CoreServices/AppleScript”

Building Froyo on Snow Leopard- Stepwise guide

I had posted a blog for “Building Froyo on Snow Leopard” previously and at that time I didn’t face any problems building Froyo but it looks like few make files have changed now. So I am writing this post as an update to my previous post.

Before starting on this, I would like to thank Tomas Isdal and andferno.

So I will note down all the steps involved in building Froyo on Snow leopard. You can refer android get source page for information. I have referred it for few of the steps involved in building android.

Step 1
Create a new partition that is a case-sensitive partition if you’re using a case-insensitive primary partition. You can refer to this for more info.

Step 2
You would also have to install Xcode 3.2 and 10.4 SDK. Xcode can be found in the installation disc. It can also be downloaded from Apple developers connection. Refer the attached image.

Xcode installation Option

Step 3
Install Macports. There are two ways of doing so.
i. Download the source from this link and untar the file. Run the following commands
sudo make install

ii. My preferred method is to download the DMG from here. I used MacPorts-1.8.2-10.6-SnowLeopard.dmg from the list.

Step 4
Make sure that /opt/local/bin is in your path before /usr/bin by running

echo $PATH

If you don’t see /opt/local/bin, edit $HOME/.bash_profile and add the line
export PATH=/opt/local/bin:$PATH
(or the equivalent for other shells) after any other PATH-related lines. To verify that your path is now correct, open a new terminal and run echo $PATH again.

Step 5
Get the following packages from port:
POSIXLY_CORRECT=1 sudo port install libsdl git-core gnupg

NOTE: Restart the terminal

Step 6
Set an appropriate per-process file descriptor limit. To do this, add the following lines to your .bash_profile file:
# set the number of open files to be 1024
ulimit -S -n 1024

Step 7
Now check out the Froyo Source code to the case-sensitive partition created in step 1, please refer android get source page for more information.

Step 8
Snow leopard doesn’t have Java 1.5, it has Java 1.6. Since Leopard has Java 1.5 this step can be skipped on Leopard. On Snow Leopard we have two options.

i. Changing Android make file to build with Java 1.6.
Open “build/core/” and search for “grep ‘[ “]1\.5” and change that “5″ with a “6″. You will find it repeated two times. This trick was suggested to me by andferno.

ii. Install Java 1.5 on Snow Leopard.

curl -o java.1.5.0-leopard.tar.gz
tar -xvzf java.1.5.0-leopard.tar.gz
sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard
cd /System/Library/Frameworks/JavaVM.framework/Versions/
sudo rm 1.5.0
sudo ln -s 1.5.0-leopard 1.5.0

We have to set Java preferences. You can either manually open “Java” or use terminal and type

open /Applications/Utilities/Java\

Change the preference to as shown in the image below. You would have to drag and drop different Java version to change the preference.

Setting Java Preferences

NOTE: Restart the terminal

Building the source and resolving errors
Build the source.

make -j2

You might face the following error first.

host C++: emulator-elff <= external/qemu/elff/
In file included from external/qemu/qemu-common.h:15,
from external/qemu/elff/elf.h:22,
from external/qemu/elff/elf_defs.h:20,
from external/qemu/elff/dwarf_defs.h:22,
from external/qemu/elff/dwarf_die.h:20,
from external/qemu/elff/elf_file.h:20,
from external/qemu/elff/
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from external/qemu/elff/dwarf_die.h:21,
from external/qemu/elff/elf_file.h:20,
from external/qemu/elff/
external/qemu/elff/elf_alloc.h: In static member function ‘static void* DwarfAllocBase::operator new(size_t)’:
external/qemu/elff/elf_alloc.h:156: warning: ‘operator new’ must not return NULL unless it is declared ‘throw()’ (or -fcheck-new is in effect)
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/emulator-elff_intermediates/elff/dwarf_cu.o] Error 1

To fix this error go to “external/qemu/” and open “” file and change the following line

iMY_CFLAGS += -mdynamic-no-pic


MY_CFLAGS += -mdynamic-no-pic -I /Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/include/

Continue with the build process again and you are likely to come across following errors

In file included from external/v8/src/macro-assembler.h:87,
from external/v8/src/jsregexp.h:31,
from external/v8/src/ast.h:33,
from external/v8/src/compiler.h:31,
from external/v8/src/
external/v8/src/arm/assembler-arm-inl.h: In constructor ‘v8::internal::Operand::Operand(const char*)’:
external/v8/src/arm/assembler-arm-inl.h:165: error: cast from ‘const char*’ to ‘int32_t’ loses precision
external/v8/src/arm/assembler-arm-inl.h: In constructor ‘v8::internal::Operand::Operand(const v8::internal::ExternalReference&)’:
external/v8/src/arm/assembler-arm-inl.h:172: error: cast from ‘v8::internal::byte*’ to ‘int32_t’ loses precision
In file included from external/v8/src/macro-assembler.h:87,
from external/v8/src/ic-inl.h:33,
from external/v8/src/
external/v8/src/arm/assembler-arm-inl.h: In constructor ‘v8::internal::Operand::Operand(const char*)’:
external/v8/src/arm/assembler-arm-inl.h:165: error: cast from ‘const char*’ to ‘int32_t’ loses precision
external/v8/src/arm/assembler-arm-inl.h: In constructor ‘v8::internal::Operand::Operand(const v8::internal::ExternalReference&)’:
external/v8/src/arm/assembler-arm-inl.h:172: error: cast from ‘v8::internal::byte*’ to ‘int32_t’ loses precision

This may not be the only precision error you may get. If you come across any errors like “error: cast from ‘abc’ to ‘xyz’ loses precision

Do the following. Open “build/core/” file and search for the following text.

PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/,true)

and replace the above text with following text.

PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/,true)

ifeq ($(HOST_OS),darwin)
HOST_GLOBAL_CFLAGS += -arch i386

Again continue the build process and you are likely to come across following error

host C: acp <= build/tools/acp/acp.c
host C++: libhost <= build/libs/host/pseudolocalize.cpp
host C: libhost <= build/libs/host/CopyFile.c
build/libs/host/CopyFile.c: In function ‘copyFileContents’:
build/libs/host/CopyFile.c:124: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘ssize_t’
build/libs/host/CopyFile.c:124: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘ssize_t’
host StaticLib: libhost (out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a)
ar crs out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/CopyFile.o
host Executable: acp (out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp)
ld: warning: in out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp.o, file is not of required architecture
ld: warning: in out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a, file is not of required architecture
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp] Error 1

To fix this error open “” present in “build/core/combo/” and find the following strings.

-dynamiclib -single_module -read_only_relocs suppress \

and add the following strings after the above string.

) \

Find the following strings

-Wl,-dynamic -headerpad_max_install_names \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \

and add the following strings after the above string.

) \

Start the build again and watch it fly. Feel free to revert back in-case of any queries.