John Bokma

Migrating Firefox from Linux to OS X

September 6, 2016

Today I migrated some of my Firefox settings from Linux to OS X. I decided to move only the settings I required instead of my entire profile, and install the extensions fresh even though just migrating the profile caused no issue when I migrated Thunderbird.

Installation of Firefox on OS X

I downloaded the latest version of Firefox via the Firefox download page. I double clicked the 86.2MB DMG and used drag and drop in the dialog window opened to install Firefox 48.0.2 into the Applications directory.

When I started Firefox for the first time I was greeted with a dialog stating:

"Firefox.app" is an application downloaded from the Internet. Are you sure you want to open it?

I clicked "Open".

The import wizard was shown and asked me if I wanted to import from Safari. I selected "Don't import anything" and clicked the "Continue" button.

In the "Default Browser" dialog I unselected "Always perform this check when starting Firefox" and clicked "Not Now".

Installing my favorite Extensions

Easy Copy

The Easy Copy add-on by Byron makes it very easy to copy the current web page address and details like title, selected text, today's date, etc. in a specific format using a template. I use this often when I want to copy a link and its text in Markdown format, or Mediawiki mark up. It's very easy to add your own templates, e.g. [%title%](%url) for Markdown.

After installing this update I restarted Firefox as recommended.

Tree Style Tab

The extension I use the most is Tree Style Tab add-on by Piro. I prefer to keep my open tabs to the right side of Firefox and the tree style makes it very convenient to group things when researching.

I've written about Tree Style Tab several years back in Six Add-ons for Firefox I love. This blog entry also tells which settings I prefer.

After installing this update I restarted Firefox as recommended.

Edit: after migrating my open tabs I noticed that the text on the tabs is centered instead of left aligned. See below for a fix.

Web Developer

Another great extension is Web Developer by Chris Pederick.

I also wrote about this extension in Six Add-ons for Firefox I love.

After installing this update I restarted Firefox as recommended.

Settings

I opened the Preferences of Firefox and made the following changes in the "General" section:

Migrating some settings

When figuring out which files I had to migrate from Linux to OS X to get my open tabs, bookmarks, history, cookies, and passwords I noticed that places.sqlite had two, what seemded, related files places.sqlite-shm and places.sqlite-wal. After some Googling I learned that both are temporary files used by SQLite; the database Firefox uses. And the easiest way to make those go, and clean up places.sqlite itself is by vacuuming.

So I quit Firefox on both operating systems. On Ubuntu 15.10 I installed sqlite3 as follows:

sudo apt-get install sqlite3

And vacuumed both places.sqlite and cookies.sqlite:

sqlite3 places.sqlite vacuum
sqlite3 cookies.sqlite vacuum

Files and sizes before:

-rw-r--r-- 1 john john  2097152 Sep  6 19:44 cookies.sqlite
-rw-r--r-- 1 john john 52428800 Sep  6 15:13 places.sqlite
-rw-r--r-- 1 john john    65536 Sep  6 18:00 places.sqlite-shm
-rw-r--r-- 1 john john   387312 Sep  6 18:00 places.sqlite-wal

And after:

-rw-r--r-- 1 john john   851968 Sep  6 19:48 cookies.sqlite
-rw-r--r-- 1 john john 47149056 Sep  6 19:46 places.sqlite

On OS X I changed into my Firefox profile directory, and only vacuumed places.sqlite to get rid of the temporary files that already had been created.

cd ~/Library/Application Support/Firefox/Profiles/oej1h8ig.default/
sqlite3 places.sqlite vacuum

The list of files and directory I wanted to migrate from the Ubuntu virtual machine to OS X is:

places.sqlite : saved annotations, bookmarks, favorite icons, input history, keywords, and browsing history

key3.db and logins.json : key to encrypt and decrypt saved passwords and the saved passwords.

cookies.sqlite : saved cookies

sessionstore.js : saved current session (tabs)

sessionstore-backups : directory containing older sessions (tabs)

I issued the following commands in the Firefox profile directory on OS X to copy the desired data from the Ubuntu host ecce:

scp john@ecce:.mozilla/firefox/27t1grtg.default/places.sqlite .
scp john@ecce:.mozilla/firefox/27t1grtg.default/key3.db .
scp john@ecce:.mozilla/firefox/27t1grtg.default/logins.json .
scp john@ecce:.mozilla/firefox/27t1grtg.default/cookies.sqlite .
rm -rf sessionstore-backups/ && mkdir sessionstore-backups/
rsync -avh john@ecce:.mozilla/firefox/27t1grtg.default/sessionstore-backups/ \
      sessionstore-backups/
scp john@ecce:.mozilla/firefox/27t1grtg.default/sessionstore.js .

I started Firefox on OS X and got all my tabs back open. I checked if I was still logged into some sites, which I was.

Improving the Firefox User Interface

Finally, I did some cleaning up of the user interface. I opened the context menu by right clicking next to the address bar of Firefox. In this menu I selected the "Customize..." option. I removed the Search, Bookmarks, Downloads, Home, Hello, and Pocket icons by dragging them away.

Using the "View" main menu entry I enabled the the Bookmarks Toolbar and Web Developer Toolbar.

After I had copied over my open tabs, see previous section, I noticed that the text was centered. This I fixed as follows:

cd ~/Library/Application Support/Firefox/Profiles/oej1h8ig.default/
mkdir -p chrome
echo '.tab-text { text-align: left !important; }' >> chrome/userChrome.css

home - blog - email

I am a freelance Perl programmer for hire, download my up-to-date resume (PDF).