Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I click on the .rar file in Firefox it offers either to open it with a default application or to save it to disk. However, the default app for .rar is set to gedit (?) So how do I change that, so that FF will offer to open .rar files with archive manager? I tried editing Preferences/Applications, but I need it to ask me first what to do and then open it ot save it. Thanks!

share|improve this question
add comment

3 Answers

Success! I just got it to work for me. Here's how I did it:

Just like @jasmines suggested, you need to modify the mimeTypes.rdf file in your Firefox profile.

First go into your Firefox profile's directory. Using a terminal, cd ~/.mozilla/firefox/ then type ls you will see a directory with a name of random letters and numbers followed by .default (mine is 73mr2fae.default) this is your profile. Type cd [the name of the profile directory] replace the brackets with your profile name (you can use the Tab key to autocomplete once you have typed the first few letters).

First back up the mimeTypes.rdf file cp mimeTypes.rdf mimTypes.rdf.backup

Next open it for editing gedit mimeTypes.rd

Now paste in the following entry (make sure not to paste it within another entry, look for a line with a closing tag </RDF:Description> then hit the Return key to paste it on a new empty line after that closing tag):

  <RDF:Description RDF:about="urn:mimetype:application/x-rar-compressed"
                   NC:fileExtensions="rar"
                   NC:description="Rar archive"
                   NC:value="application/x-rar-compressed"
                   NC:editable="true">
    <NC:handlerProp RDF:resource="urn:mimetype:handler:application/x-rar-compressed"/>
  </RDF:Description>

Looks like Firefox will automatically alphabetize it later so as long as you don't put it inside another tag you should be set.

Next look for a section starting with <RDF: Seq... it will probably look like this:

  <RDF:Seq RDF:about="urn:mimetypes:root">
    <RDF:li RDF:resource="urn:mimetype:application/x-debian-package"/>
    <RDF:li RDF:resource="urn:mimetype:application/pdf"/>
    <RDF:li RDF:resource="urn:mimetype:application/x-zip-compressed"/>
    <RDF:li RDF:resource="urn:mimetype:application/x-msdownload"/>
    <RDF:li RDF:resource="urn:mimetype:application/zip"/>
    <RDF:li RDF:resource="urn:mimetype:application/x-tar"/>
    <RDF:li RDF:resource="urn:mimetype:application/epub+zip"/>
  </RDF:Seq>

Add the line <RDF:li RDF:resource="urn:mimetype:application/x-rar-compressed"/> somewhere inside this tag, I don't think the order matters.

Here is what mine looks like afterwards:

  <RDF:Seq RDF:about="urn:mimetypes:root">
    <RDF:li RDF:resource="urn:mimetype:application/x-debian-package"/>
    <RDF:li RDF:resource="urn:mimetype:application/pdf"/>
    <RDF:li RDF:resource="urn:mimetype:application/x-zip-compressed"/>
    <RDF:li RDF:resource="urn:mimetype:application/x-msdownload"/>
    <RDF:li RDF:resource="urn:mimetype:application/zip"/>
    <RDF:li RDF:resource="urn:mimetype:application/x-tar"/>
    <RDF:li RDF:resource="urn:mimetype:application/x-rar-compressed"/>
    <RDF:li RDF:resource="urn:mimetype:application/epub+zip"/>
  </RDF:Seq>

Save the file. Restart Firefox and download a .rar file (I used the test files here: http://www.maximumcompression.com/data/files/index.html).

The first time the dropdown box might look a little weird. But you can still click on it and select Archive Manager. Subsequent times it appears to remember this choice.

Hope this works for you!

share|improve this answer
    
@Mujahid I already had Unarchiver for .rar files (non-free version) (unrar) installed, still I unmarked it and then marked it again and installed also some other Add-ons and then while trying the second advise by @adempewolff I found out that I already have in my mimeTypes.rdf the following: <RDF:Description RDF:about="urn:mimetype:application/x-rar" NC:value="application/x-rar" NC:editable="true" NC:description="RAR archive"> <NC:handlerProp RDF:resource="urn:mimetype:handler:application/x-rar"/> </RDF:Description> It works! –  brijabasi May 24 '12 at 11:59
    
Thank you both! –  brijabasi May 24 '12 at 12:00
add comment

Try editing /home/[your user]/.mozilla/firefox/[your profile].default/mimeTypes.rdf (back it up, first!!!).

You may want to change each occurence of:

 NC:useSystemDefault="false"

to:

 NC:useSystemDefault="true"
share|improve this answer
add comment

Install Archive Manager from Ubuntu Software Centre if it is not already installed. Once installed, it will automatically show as an option, when you click on the downloaded rar file. If the Archive Manager is already installed, Open Ubuntu Software Centre, search for Archive Manager, click on More Info, scroll down, and from the list of Add-ons select Unarchiver for .rar files (non-free version) (unrar). Then select Apply Changes.

share|improve this answer
    
I don't think this will work. I can confirm that I have Archive Manager installed and it does not show up as an option for .rar files. It does show up for .tar and .zip files though. –  adempewolff May 24 '12 at 9:42
    
@adempewolff, please see that I have edited my reply and downloaded a rar file from the Internet using Firefox to confirm and it works! –  Mujahid May 24 '12 at 10:09
    
Hmm, very weird. I have not installed that add-on and I am still able to open .rar files (tested using these files maximumcompression.com/data/files/index.html). However I could believe that installing this extra add-on might wake up Firefox and force it to add the x-rar mimetype. –  adempewolff May 24 '12 at 10:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.