Install Mobi2Mobi Mac

From MobileRead
Jump to: navigation, search

This page of the Visual Kindle Guide was created by Leep, pilotbob and daffy4u and tweaked by pdurrant

If you have any questions, please post in this thread on MobileRead.


[edit] How to install MobiPerl (Mobi2Mobi) on Mac OS X

The following directions were performed on Leopard (Mac OS X 10.5.x) and are expected to work on Tiger (Mac OS X 10.4.x) but are untested. If you are able to follow these directions on Tiger please edit this disclaimer out.

[edit] Software needed

  • Latest version of Mobiperl
  • Latest Version of LibGD tar.gz
  • OS X version of ConvertLIT
  • JEPG Library from Independent JPEG Group libjpeg
  • XCode Tools (on your Mac OS X Install Disk 2)

[edit] Step 1

Install Xcode Tools from your OS X Install Disk. The tools will be on disk 1 or disk 2 depending on what type of Mac you have. These tools are not included by default on new Mac. (If you have already done this you can skip this step.) Insert the Disk into your Mac. When the drive is mounted on the desktop double click on it. You will see the Xcode Tools folder.

Note: You can also download these tools from the Mac developer web site for free. You will need to get a free ADC login first however.


Double click on the Xcode Tools folder to open it. You will see the XcodeTools.mpkg installer package.


Double click on the XcodeTools.mpkg install file. The Installer wizard will display. Click through the continue button accepting all the defaults to install this utility.


[edit] Step 2

Download the all required software listed above to your Downloads folder.


[edit] Step 3

Extract the archives of each download by double clicking on each file. A folder will be created for each tool and the clit file will be extracted.


[edit] Step 4

Install libjpeg. Open a Terminal window and navigate to the jpeg-6b folder by typing the following command and pressing return:

cd ~/Downloads/jpeg-6b


Type the following commands in the Terminal window, one at a time pressing return after each command. Some commands result in a few hundreds of lines of response so I have not picture this here. The first time you use sudo you may be prompted for your Mac administrator password. Enter it and press return when asked.

First, we need to make the directories that the jpeg lib expects to be present. These might already be on your system, in which case you'll get an error that the file exists. Just ignore this error if it happens.

sudo mkdir /usr/local/include
sudo mkdir /usr/local/lib
sudo mkdir -p /usr/local/man/man1

Now to make the library itself.

(use 10.4 if you have Tiger.)
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
./configure --enable-shared
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a

(Note those full stops at then end of some lines. Copy and paste is the best way to issue the commands without typos.)

[edit] Step 5

Install libgd. Navigate to the gd-x.x.xx folder. Adjust the version numbers acordingly. v2.0.35 was the latest version when this Wiki page was created.

cd ~/Downloads/gd-2.0.35


Type the following commands in the Terminal window one at a time pressing return after each command. Some commands result in a few hundreds of lines of response so I have not picture this here.

sudo ln -s /usr/X11R6/include/fontconfig /usr/local/include

Presently, configure should report that GD will support PNG, JPEG and FreeType:


If the above is correct type the following commands to install libgd. If the above is not correct you possible installed libjpeg incorrectly.

sudo make install

[edit] Step 6

Add Perl modules needed by mobiperl package. We will do this using CPAN which is a module installer for Perl. To run CPAN type the following command in your Terminal window:

sudo perl -MCPAN -e shell

The first time you run CPAN it will ask if you want it to configure it manually. The defaults should work fine, so just type


and press return. If you accidentally type return, just accept the defaults offered in subsequent questions.

After that you will be prompted to select a repository that CPAN will use to fetch the modules. Just follow the prompts to your nearest repository, or select more than one if you wish.

You'll then be in the CPAN shell, which will be waiting for a command at the CPAN> prompt.


At this point it's a good idea to upgrade your CPAN shell to the latest version. This is a simple process. Just enter the following two commands, one at a time at the CPAN> prompt, pressing Return after each one. The first one takes a while and generates lots of output! When you get asked questions during this process, just accept the default each time by pressing Return.

install Bundle::CPAN

Now run CPAN again by typing the following command in your Terminal window:

sudo perl -MCPAN -e shell

When I did this, I got told some configuration parameters were missing, and whether I wanted to "Always commit changes to config variables to disk?" The default was no, but I think it best to enter yes. Then accept all the other defaults.

Once you are back at the cpan> prompt, enter the following commands one at a time pressing Return after each one. For each module CPAN will either install, update or tell you the module is uptodate.

install Palm::PDB
install XML::Parser::Lite::Tree
install GD
install Image::BMP
install Image::Size

(Image::Size might have some pre-requisites. It will prompt you as to whether you want to install them. Just accept the default [yes] answer at the prompt.)

install HTML::TreeBuilder
install Getopt::Mixed
install Date::Parse
install Date::Format

Once done type q at the CPAN prompt and CPAN will exit.

[edit] Step 7

Copy scripts to your tools folder and link it to your path. Use finder to create a folder to store your eBook tools in. I use a tools folder in an eBooks folder in my home directory (~/eBooks/tools). So, using finder perform the following steps:

  • Create a tools folder to house the mobiperl and clit files.
  • From the mobiperl-0.0.xx folder in your Downloads folder copy html2mobi, lit2mobi, mobi2html, mobi2mobi mobils, opf2mobi, MobiPerl folder and the Palm folder into your tools folder. Copy clit from your download folder to your tools folder.


Run the following command in the Terminal window to create links to the scripts in your local bin folder. This will allow you to run these commands from any folder on you system. Type each command one at a time and press return. If sudo prompts for a password enter your Mac administrator password.

cd /usr/local/bin
sudo ln -s ~/eBooks/tools/clit clit
sudo ln -s ~/eBooks/tools/html2mobi html2mobi
sudo ln -s ~/eBooks/tools/lit2mobi lit2mobi
sudo ln -s ~/eBooks/tools/mobi2html mobi2html
sudo ln -s ~/eBooks/tools/mobi2mobi mobi2mobi
sudo ln -s ~/eBooks/tools/mobils mobils
sudo ln -s ~/eBooks/tools/opf2mobi opf2mobi
Note: when there is a newer version of mobiperl available you will only need to update the files in your ~/eBooks/tools folder. 
You will not need to recreate the links as they will point to the newer files automatically as long as they are in the same location. 

Congratulations you have hopefully successfully installed the Mobiperl tools!

--Pilotbob 19:09, 15 November 2008 (EST)

[edit] Useful Links

Mac Os X Wikipedia

Related to Mac Os Articles

Personal tools

MobileRead Networks