Alex Rivera | Logout

How can I make Emacs Org-mode open links to sites in Google Chrome?

Asked 2010-12-22T04:50:17.003
48

Google Chrome is set as the default browser. However, it opens links in Firefox, which is undesired.

How can I make Org-mode to open links in Google Chrome?

Edit
Report

1 Answer

7

I have a similar problem (although the other way around: I wanted Emacs to open Firefox, but it opened Chromium).

I'm using Ubuntu 12.04 (Precise Pangolin), but already had the problem with UbuntuĀ 11.10 (Oneiric Ocelot). The solution below applies to Linux, maybe macOS (?), and probably not Windows.

Setting browse-url-generic-program as suggested in other answers didn't work for me. Note also that my default browser is generally Firefox: that's what most other applications are using to open a URL, including xdg-open. So I was surprised that Emacs would do otherwise.

I finally figured out that Emacs is using the sensible-browser (1) script. Looking at that script, I noticed that:

  • it first looks at the BROWSER environment variable;
  • else, it tries several other generic scripts, starting with gnome-www-browser

It so happens that, on my machine, BROWSER is not set, but gnome-www-browser is a script apparently put there by Chromium, and (naturally) running Chromium.

So, long story short: putting the following line

export BROWSER=firefox # Or any browser of your choice

in your .profile may help if Emacs is not using the correct browser.

answered 2012-04-30T13:24:53.920

Your Answer