1
votes

I overwrote some of my dylib files in /usr/local/bin/ and now I'm having issues running a program. Is there a way of restoring these files back?

The program ffmpeg was running fine for me. Then I installed the program GPAC and did the following:

$ sudo cp MP4Box /usr/local/bin/

$ sudo cp -R /Applications/GPAC.app/Contents/MacOS/lib/* /usr/local/lib/

I did this because it would allow me to run MP4Box from the command line since /usr/local/lib/ is in $PATH.

But now when I try running

$ ffmpeg

I get this error:

dyld: Library not loaded: /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib Referenced from: /usr/local/bin/ffmpeg Reason: Incompatible library version: ffmpeg requires version 10.0.0 or later, but libSDL2-2.0.0.dylib provides version 5.0.0 Abort trap: 6

I think what happened is: I overwrote some files into /usr/local/lib/ that I shouldn't have done. In this case, I overwrote the version 10.0.0 libSDL2-2.0.0.dylib with version 5.0.0 from the GPAC app bundle.

I have tried using homebrew to uninstall and reinstall ffmpeg, hoping that it would see that it would need to update my dylib libraries.

$ brew uninstall ffmpeg

$ brew install ffmpeg

$ ffmpeg

But this results in the same error.

Here is the list of all the files I copied from /Applications/GPAC.app/Contents/MacOS/lib/* to /usr/local/lib/

libSDL2-2.0.0.dylib libfreetype.6.dylib libplds4.dylib liba52.0.dylib libgpac.dylib libpng16.16.dylib libavcodec.58.dylib libjpeg.9.dylib libpostproc.55.dylib libavdevice.58.dylib liblzma.5.dylib libssl.1.0.0.dylib libavfilter.7.dylib libmad.0.dylib libswresample.3.dylib libavformat.58.dylib libmozjs185.1.0.dylib libswscale.5.dylib libavresample.4.dylib libmp3lame.0.dylib libtheora.0.dylib libavutil.56.dylib libnspr4.dylib libvorbis.0.dylib libcrypto.1.0.0.dylib libogg.0.dylib libx264.152.dylib libfaad.2.dylib libplc4.dylib

1

1 Answers

2
votes

While running brew to reinstall ffmpeg directly did not work, I found out that running brew to reinstall ffmpeg's dependencies did work.

So for the earlier example, libSDL2-2.0.0.dylib wasn't loading correctly. I googled brew libSDL2-2.0.0.dylib, and found out that the brew package name for this was sdl2.

I ran

$ brew reinstall sdl2

$ ffmpeg

and I didn't get the libSDL2-2.0.0.dylib error anymore! I repeated this for each low level library that ffmpeg said it needed, and it eventually worked.