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
- Download Firefox Betas
- lsof - list open files
- grep - print lines matching a pattern
- killall - kill processes by name
- sudo - execute a command as another user
- Eric's Agile Answers - for the tip on stopping and starting the VPN agent with launchctl
I didn't get the same message, I got:
ReplyDeletefirefox-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 (?)
Deleting all the dylib files from the old Firefox before dragging the new one to the Applications folder worked for me.
ReplyDeleterm /Applications/Firefox.app/Contents/MacOS/*.dylib
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
ReplyDeleteI 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
ReplyDeleteHi Dave,
ReplyDeleteThe Terminal is located under Applications > Utilities.
Thank you for this!!!
ReplyDeleteThis 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.
ReplyDeletewhile [ 1 ]; do sudo killall vpnagentd; done;
ReplyDeleteHi, if you're *not* running Cisco VPN and discover the same problem, but
ReplyDeletelsof -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.
I'm surprised that lsof -V didn't pick up Evernote as using the file.
ReplyDeleteI put in the command and got
ReplyDelete-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?
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
ReplyDelete"lsof -V | grep libsmime3.dylib"
hmm maybe it is run as root, so sudo lsof .....???
ReplyDeleteI tried an alternate approach to work around the vpnagentd problem:
ReplyDelete1. 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
this isn't working for me. When i type in any of the above my terminal does nothing.
ReplyDeleteIf killing vpnagentd and quitting Evernote didn't work, you might try also quitting Dropbox. Worked for me.
ReplyDeleteI 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
ReplyDeletetry the following command
ReplyDeletelaunchctl load /Library/LaunchDaemons/com.cisco.anyconnect.vpnagentd.plist
a restart should get you VPN up and running again
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.
ReplyDeleteExcellent! This worked perfectly!! Thank you so much!
ReplyDeleteawesome. thanks.
ReplyDeleteHi 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
ReplyDeleteWorks perfect!
This was AWESOME! Thanks so much for your help. THis helped me load Firefox 5 for Mac. You rock.
ReplyDeleteGreat!! 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!
ReplyDeletethis worked for me, thanks a lot!
ReplyDeleteThanks! Very good instructions.
ReplyDeletethis is very helpful! thankyou!
ReplyDeleteThanks for the help
ReplyDeleteThanks so much for this tip really helpful
ReplyDeletedanke für den super Tip aus Deutschland!!
ReplyDeletefantastic! I needed the extra bit to shutoff the fast re-start of the daemon. wish i'd come to your site first! thanks!!
ReplyDeleteThanks 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:
ReplyDeletelaunchctl: 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.
awesome, thanks for the help
ReplyDeleteThis did the trick, thanks!
ReplyDeleteGracias! :)
ReplyDeleteYou don't have something simpler ?
ReplyDeleteI 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
The unload command wasn't working for me when trying to prevent vpnagentd from restarting.
ReplyDeletesudo 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
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!
ReplyDeleteAfter I was done, I wrote the code to restart the VPNagent, and it started up again just fine.
Worked like a charm. Many thanks.
ReplyDelete