Wednesday, November 17, 2010

Firefox 4: libsmime3.dylib in use error during Mac OS X install


I have been using Firefox 4 betas on my Windows box for a while now and decided to upgrade my Mac OSX version. After downloading and opening up the dmg I tried to replace my existing Firefox 3.6 copy (after Quitting of course) and got an error saying that it couldn’t replace Firefox because file libsmime3.dylib was in use and pretty much out of luck.

After a few quick searches on Google I found out that it a common error even when upgrading to 3.6. One of the nice things about OS X is that you’ve got a BSD system and plenty of tools at your disposal. Here’s what you do to find which application is using a specific file and how to kill it.

Update: Before trying the following commands quit Evernote and Dropbox and try to replace Firefox again (thanks to Sebastian and Kim Mullins).

First open up a Terminal (Located under Applications > Utilities) and at the command prompt type the following command to find the application locking the file

sudo lsof -V | grep libsmime3.dylib

In my case this is the output I got indicating that vpnagentd was the application with the file in use.
 
vpnagentd 136 root txt REG 14,2 267408 28103066 /Applications/Firefox.app/Contents/MacOS/libsmime3.dylib

vpnagentd is a component of the Cisco Anywhere Connect VPN client (which I use to remote into work). Anyway, in order to do your upgrade you’ll need kill the app with either of the following commands

1. Using the process name (first column in the output)

sudo killall vpnagentd

2. Using the Process ID (second column in the output). You'll need to use this if you get a message like "No matching processes belonging to you were found" which means that probably the process name was truncated in the output.

sudo kill -9 136

Replace 136 with the number in the second column of the output.

After that you should be able to replace your existing Firefox application.

In some cases vpnagentd is set up to autostart which will respawn after you kill the process. In this case you'll need to enter a few more commands

cd /Library/LaunchDaemons/
sudo launchctl stop com.cisco.anyconnect.vpnagentd    
sudo launchctl unload com.cisco.anyconnect.vpnagentd.plist    
sudo killall vpnagentd

To start vpnagentd execute the following command:

cd /Library/LaunchDaemons/
sudo launchctl load com.cisco.anyconnect.vpnagentd.plist

References and further reading

39 comments:

  1. Franjipani216/1/11 2:07 AM

    I didn't get the same message, I got:

    firefox-b 285 myname txt REG 14,2 271504 1745901 /Applications/Firefox.app/Contents/MacOS/libsmime3.dylib
    My-Names-MacBook-Pro:~ myname$

    with no reference to VPN (although I do have VPN connected. Does this mean that I should enter

    sudo killall firefox-b 285 myname (?)

    ReplyDelete
  2. Deleting all the dylib files from the old Firefox before dragging the new one to the Applications folder worked for me.

    rm /Applications/Firefox.app/Contents/MacOS/*.dylib

    ReplyDelete
  3. great - worked just fine your kill all even though it first denied there was any such file on my machine as the libsmime3.dylib --- so i just ran your kill all (for novices like me you have to bring down the new command menu in Terminal - Edit (i think) and then put the commands in there - not just copy them in.... or so it seemed to me just now

    ReplyDelete
  4. Davidlowden8/3/11 3:43 AM

    I know this will be a basic question for most but what does "Open up a terminal mean" .. I can't work out where to type the instructions to get rid of libsmime3.dylib. Any help appreciated, thanks, Dave

    ReplyDelete
  5. Hi Dave,

    The Terminal is located under Applications > Utilities.

    ReplyDelete
  6. Thank you for this!!!

    ReplyDelete
  7. This didn't work for me as vpnagentd simply respawned with a new PID as soon as it was killed. I ended up uninstalling AnyConnect using the Cisco uninstaller and then I was able to replace 3.6.15 with 4. I didn't get around to spotting the solution of deleting the dylib files from the old FF package, so that might have worked as well (and would have been easier!) Just figured I'd post this as a working solution in case nothing else is working for you.

    ReplyDelete
  8. while [ 1 ]; do sudo killall vpnagentd; done;

    ReplyDelete
  9. Hi, if you're *not* running Cisco VPN and discover the same problem, but

    lsof -V | grep libsmime3.dylib

    doesn't produce any results, chances are you might have Evernote running in the background. Quit Evernote and try installing the new version.

    Worked for me.

    ReplyDelete
  10. I'm surprised that lsof -V didn't pick up Evernote as using the file.

    ReplyDelete
  11. I put in the command and got

    -lsof: status error on |: No such file or directory
    -lsof: status error on grep: No such file or directory
    -lsof: status error on libsmime3.dylib: No such file or directory
    -lsof 4.82

    etc etc.

    Help?

    ReplyDelete
  12. for some reason lsof is not liking the parameters you've entered. try entering the command as follows again without the ", you should be able to copy-paste the command

    "lsof -V | grep libsmime3.dylib"

    ReplyDelete
  13. hmm maybe it is run as root, so sudo lsof .....???

    ReplyDelete
  14. I tried an alternate approach to work around the vpnagentd problem:

    1. Move Firefox 3.6.x into the trash (if you try to empty the trash at this point you will still get the libsmime3.dylib in use error message)

    2. Restart your computer

    3. Empty the trash

    4. Install Firefox 4

    ReplyDelete
  15. this isn't working for me. When i type in any of the above my terminal does nothing.

    ReplyDelete
  16. If killing vpnagentd and quitting Evernote didn't work, you might try also quitting Dropbox. Worked for me.

    ReplyDelete
  17. piqueen31428/3/11 7:18 PM

    I did the sudo killall vpnagentd command and then installed firefox 4, but now my vpn will not work anyone know how to fix this issue

    ReplyDelete
  18. try the following command

    launchctl load /Library/LaunchDaemons/com.cisco.anyconnect.vpnagentd.plist

    a restart should get you VPN up and running again

    ReplyDelete
  19. I've updated the post with the launchctl commands to stop and unlaod the VPN client before the killing the process. In some cases vpnagentd is set to restart automatically.

    ReplyDelete
  20. Excellent! This worked perfectly!! Thank you so much!

    ReplyDelete
  21. awesome. thanks.

    ReplyDelete
  22. Hi out there, thank you very much! This helped me when installing Firefox 5.0 while replacing Firefox 4.0 for Mac OS 10.5.8

    Works perfect!

    ReplyDelete
  23. This was AWESOME! Thanks so much for your help. THis helped me load Firefox 5 for Mac. You rock.

    ReplyDelete
  24. Great!! I ran sudo lsof -V | grep libsmime3.dylib then sudo killall vpagentd. I ran sudokill -9 [my process number] but got "No such process" Anyway, the first two commands did the job.THANKS!

    ReplyDelete
  25. Cottermarty27/6/11 5:58 AM

    this worked for me, thanks a lot!

    ReplyDelete
  26. Thanks! Very good instructions.

    ReplyDelete
  27. this is very helpful! thankyou!

    ReplyDelete
  28. Thanks for the help

    ReplyDelete
  29. George Charleston21/9/11 4:55 PM

    Thanks so much for this tip really helpful

    ReplyDelete
  30. danke für den super Tip aus Deutschland!!

    ReplyDelete
  31. fantastic! I needed the extra bit to shutoff the fast re-start of the daemon. wish i'd come to your site first! thanks!!

    ReplyDelete
  32. Thanks for the advice. All worked fine until I tried to relaunch VPN. When I entered the commands you suggested to relaunch, I got the message:
    launchctl: Couldn't stat("com.cisco.anyconnect.vpnagentd.plist"): No such file or directorynothing found to loadThen, when I entered the command you suggested in the above post, I got the message:Couldn't stat("/Library/LaunchDaemons/com.cisco.anyconnect.vpnagentd.pilst"): No such file or directory
    nothing found to loadAnyone have any suggestions from here?  Thanks so much.

    ReplyDelete
  33. Nelsoncrestonfood30/12/11 2:14 AM

    awesome, thanks for the help

    ReplyDelete
  34. This did the trick, thanks!

    ReplyDelete
  35. Matt Hudson1/3/12 9:25 AM

    Gracias! :)

    ReplyDelete
  36. Brigitte Fayet19/3/12 3:22 PM

    You don't have something simpler ?
    I am afraid of doing all this and then not being able to use Firefox anymore : I already have the problem with Safari quitting after every 30 seconds !

    I would appreciate an "automatic thing" doing every of these contros and things for me !
     
    Bridget

    ReplyDelete
  37.  The unload command wasn't working for me when trying to prevent vpnagentd from restarting. 

    sudo launchctl unload com.cisco.anyconnect.vpnagentd.plist
    launchctl: Couldn't stat("com.cisco.anyconnect.vpnagentd.plist"): No such file or directory
    nothing found to unload.

    As someone mentioning just removing the previous version of the app manually, I entered the following via commandline:

    rm -rf /Applications/Firefox.app

    Then I was able to drag the new version into Applications without an issue.  All of my bookmarks and settings intact.

    HTH

    ReplyDelete
  38. Wow. thank you so much. Apparently my VPNagent was set to autostart, and would create a new Process ID each time I killed it. The code you wrote worked PERFECTLY. Thank you so much! 
    After I was done, I wrote the code to restart the VPNagent, and it started up again just fine. 

    ReplyDelete
  39. Worked like a charm. Many thanks.

    ReplyDelete