Mac OS 10.6 での Firefox の Command Line Options

Firefox ターミナル操作

Last update: 2009-09-07

Mac OS 10.6 では Terminal.app から行う Firefox の Command Line Options に変更が有り、/Applications/Firefox.app/Contents/MacOS/firefox - の記述で実行できなくなり、firefox-bin を使用しなければならなくなった。

firefox-bin を使うことは MDC の Command Line Options にも記載されているので、それに従えば良いのだけど、Firefox のターミナルコマンド でまとめた中ではその記述も書いていたので、Mac OS 10.6 向けに再編集する。これは Mac OS 10.5 でも使用できるので、今後はこちらを参照下され。
なお、8月末あたりまでは Bush Script で "firefox" と記述した場合にクラッシュが起きていたが、現在は実行できなくなり run-mozilla.sh: Cannot execute と表示される。
参照情報:Bug 513747 - SQLite incompatibility causes crashes on Snow Leopard (Mac OS X 10.6)mozillaZIne.jp フォーラムCommand Line Option については MDC の情報を参照して欲しい。

基本コマンドと操作

基本コマンドは以下の2つ。Firefox がデフォルトディレクトリの Applications (アプリケーション) にインストールされていることが前提。異なるディレクトリやフォルダを介している場合はアプリケーションまでのパスを書き換えること。

Full Path
/Applications/firefox.app/Contents/MacOS/firefox-bin 
Current Directory
cd /Applications/firefox.app/Contents/MacOS/; ./firefox-bin 

コマンドライン設定オプションは Terminal.app を起動し、ウィンドウ内の $ の後にコマンドを入力する。Terminal ではスペースや大文字小文字の区別が厳格に適応されるので注意すること。

Terminal window

Firefox の情報を取得する

利用できるコマンドラインを表示する

Firefox が利用できる オプションコマンドラインを調べる。「***」には h または help または ? の何れかを入力する。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -***
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -***

Firefox のバージョンを表示する

Firefox のバージョンを Terminal に表示する。-v または -version のどちらでも可能。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -v
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -v

起動

セーフモード起動

Firefox 3 以降はアプリケーションアイコンを option を押しながらクリックすることでセーフモード起動が可能となっているので、通常はそちらを利用するとよい。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -safe-mode
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -safe-mode
NOTE:
Firefox を終了していること。起動状態で使用するとアラートが表示されコマンドは実行できない。

プロファイルマネージャ起動

Firefox のプロファイルマネージャを起動する。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -ProfileManager
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -ProfileManager
NOTE:
ProfileManager は p としても実行可能。
Firefox を終了していること。起動状態で使用するとアラートが表示されコマンドは実行できない。

プロファイルを指定して起動する

複数のプロファイルを保存していて、その中から指定したプロファイルで起動したい場合に使用する。「***」にはプロファイル名を入力する。例えばプロファイルフォルダ名称が j92w8af5v.default の場合は ドット以下の default がプロファイル名。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -p ***
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -p ***
NOTE:
プロファイル名は大文字・小文字を区別するので注意すること。
プロファイル名に「スペース」が含まれる場合は、スペースの前にバックスラッシュ「」を入れてエスケープする必要がある。
起動中のプロファイルを指定してしまった場合は「複数の…を起動することはできません」とアラートが表示される。

異なるプロファイルを指定して同バージョンの Firefox を複数起動する

解説には同一バージョンの Firefox を異なるプロファイルを使用して同時起動する場合に使用するとある。だが、一つ上の「プロファイルを指定して起動する」との差が分り難い。
このコマンドは -no-remote -p プロファイル名というように記述しする。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -p プロファイル名
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -no-remote -p プロファイル名

デフォルト以外のディレクトリに置いたプロファイルで起動する

デフォルトのプロファイルディレクトリ (Users Home/Library/Application Support/Firefox/Profiles/) 以外に置いたプロファイルを指定して Firefox を起動する。
この場合はプロファイル名ではなくプロファイルのパスを記述しなければならない点が上記のものとは異なる。また -p ではなく -Profile または -profile と記述しなければ実行できない。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -Profile プロファイルの絶対パス
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -Profile プロファイルの絶対パス

例えば、HDD2 という名前の外部 HDD に置いた a0a0a0a0a0.ExternalProf というプロファイルを指定する際の記述はこうなる:

e.g.
/Applications/Firefox.app/Contents/MacOS/firefox-bin -Profile /Volumes/HDD2/a0a0a0a0a0.ExternalProf
or
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -Profile /Volumes/HDD2/a0a0a0a0a0.ExternalProf

ブラウザコンポーネントを起動

ということだが、実際には通常の起動と同じように見えるのだが・・・どういう事に利用できるのか分っていない。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -browser
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -browser

起動時の動作

起動時に JS エラーコンソールを開く

Firefox が何かの理由でフリーズや異常終了してしまった場合、エラーコンソールから起動することで何が問題なのか知ることができる場合もある。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -jsconsole
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -jsconsole
NOTE:
Firefox を終了していること。起動状態で使用するとアラートが表示されコマンドは実行できない。

起動時に Firefox の設定移行アシスタントを開く

設定移行アシスタントで起動して、他ブラウザから設定、ブックマーク、履歴、パスワードなどのデータを読み込む。読み込みを続けた場合、それまで使用していた Firefox の設定は上書きされることに注意すること。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -migration
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -migration

起動時に Firefox の環境設定を開く

Firefox の環境設定パネルを起動時に開く。環境設定に関係する問題が起きている場合は有益かも。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -preferences
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -preferences

URL を指定して Firefox を起動する

指定した URL を起動時に表示する。「***」には http://www.mozilla.org → www.mozilla.org のように http:// を除いた URL を入力する。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin ***
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin ***

指定した URL を、新規タブで開いて起動

指定した URL を、起動時のウィンドウの新規タブに開く。-new-tabに続けてスペース、次の「***」には http://www.mozilla.org → www.mozilla.org のように http:// を除いた URL を入力する。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -new-tab ***
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -new-tab ***

デフォルトの検索エンジンを使用して指定したキーワードの検索結果を起動時に表示する

-searchに続けてスペース、次の「***」に検索したいキーワードを入力する。キーワードは日本語/英語のどちらでも良いようだ。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -search ***
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -search ***

名前を付けたユーザプロファイルを作る(アプリケーションは起動しない)

プロファイルマネージャから起動することなく、Terminal から新しいプロファイルを作るコマンド。最初に作ったプロファイルのコマンドに続いて、プロンプトの後にコマンドを続けると、いくつでも作ることができる。「***」にはプロファイル名を入力するが、単語間にスペースを含めることはできないので注意。

Full Path
/Applications/Firefox.app/Contents/MacOS/firefox-bin -CreateProfile ***
Current Directory
cd /Applications/Firefox.app/Contents/MacOS/; ./firefox-bin -CreateProfile ***

その他のコマンド

ここで取り上げたコマンドは実際にテストしてみたもののみ、一般的に利用しないだろうと思われるものは省いた。MDC の Command Line Options にはこの他にも利用可能なコマンドがあるので、それらは実際にテストして欲しい。
以下は応用として Firefox とプロファイルが存在し、任意の処理を行いたいという場合のコマンドを組み合わせて使用する方法を書いてみる。
基本は Firefox-binのパス[スペース]-p[スペース]プロファイル名指定[スペース]コマンド。上記プロファイルを指定して同バージョンの Firefox を複数起動するもこのグループに入る。

指定した Firefox とプロファイルでセーフモード起動

Full Path
/Firefox.app へのパス/Contents/MacOS/firefox-bin -p プロファイル名 -safe-mode
Current Directory
cd /Firefox.app へのパス/Contents/MacOS/; ./firefox-bin -p プロファイル名 -safe-mode

指定した Firefox と外部 HDD に置いたプロファイルでセーフモード起動する

デフォルト以外のディレクトリに置いたプロファイルで起動するの応用版。firefox-bin へのパスの後に-Profile[スペース]外部HDDに置いたプロファイルへの絶対パスでプロファイルを指定し、-safe-mode でセーフモードを続ける。

Full Path
/Firefox.app へのパス/Contents/MacOS/firefox-bin -Profile 外部HDDに置いたプロファイルへの絶対パス -safe-mode
Current Directory
cd /Firefox.app へのパス/Contents/MacOS/; ./firefox-bin -Profile 外部HDDに置いたプロファイルへの絶対パス -safe-mode

Return to Top