Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Homebrew fix - unexpected files and libs from ‘osxfuse'
#!/usr/bin/env ruby
#
# Homebrew fix 1 - osxfuse dylibs
#
# original solutions: https://gist.github.com/aaronzirbes/3239033
# https://gist.github.com/trinitronx/5437061
#
# Fixes the following:
#
# > Warning: Unbrewed dylibs were found in /usr/local/lib.
#
# > Unexpected dylibs:
# > /usr/local/lib/libmacfuse_i32.2.dylib
# > /usr/local/lib/libmacfuse_i64.2.dylib
# > /usr/local/lib/libosxfuse_i32.2.dylib
# > /usr/local/lib/libosxfuse_i64.2.dylib
#
# > Warning: Unbrewed .la files were found in /usr/local/lib.
#
# > Unexpected .la files:
# > /usr/local/lib/libosxfuse_i32.la
# > /usr/local/lib/libosxfuse_i64.la
#
# > Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
#
# > Unexpected .pc files:
# > /usr/local/lib/pkgconfig/osxfuse.pc
LIBS = %w[
libmacfuse_i32.2.dylib
libosxfuse_i32.2.dylib
libosxfuse_i64.2.dylib
libmacfuse_i64.2.dylib
libosxfuse_i32.la
libosxfuse_i64.la
pkgconfig/osxfuse.pc
].map {|libname| "/usr/local/lib/#{libname}" }
TRUECRYPT_LIB_PATH = '/Applications/TrueCrypt.app/Contents/Resources/Library'
abort "This fix appears to be unnecessary! Diagnose issues by running 'brew doctor'." unless LIBS.detect do |lib|
!(File.exist?("#{TRUECRYPT_LIB_PATH}/#{File.basename(lib)}") && File.symlink?(lib))
end
begin
require 'fileutils'
rescue # perform ops using shell
`mkdir -p #{TRUECRYPT_LIB_PATH}` unless Dir.exist? TRUECRYPT_LIB_PATH
LIBS.each do |lib|
libdir = "#{TRUECRYPT_LIB_PATH}/#{lib}"
abort "Failed to copy #{lib} to #{libdir}" unless `cp -v #{lib} #{libdir}`
abort "Failed to remove #{lib}" unless `rm -v #{lib}`
end
else # perform ops using Ruby
FileUtils.mkdir_p TRUECRYPT_LIB_PATH unless Dir.exist? TRUECRYPT_LIB_PATH
FileUtils.cp LIBS, TRUECRYPT_LIB_PATH, :verbose => true
FileUtils.rm LIBS, :verbose => true
ensure
LIBS.each {|lib| File.symlink "#{TRUECRYPT_LIB_PATH}/#{File.basename(lib)}", lib }
end
puts "Homebrew 'osxfuse dylib' fix applied successfully! Latest version at: https://gist.github.com/SteveBenner/10938596"
puts `brew prune && brew doctor`
@SteveBenner

This comment has been minimized.

Copy link
Owner Author

commented Apr 16, 2014

Make sure this script has executable permissions, of course. You could use chmod +x brewfix1-osxfuse.rb.

@emrass

This comment has been minimized.

Copy link

commented Jun 24, 2014

Worked like a charm - thank you!

@epuska

This comment has been minimized.

Copy link

commented Jun 28, 2014

Awesome. Many thanks!

@lukePeavey

This comment has been minimized.

Copy link

commented Sep 4, 2014

Just to confirm, Will Truecrypt continue to work after running this script?

@SteveBenner

This comment has been minimized.

Copy link
Owner Author

commented Sep 18, 2014

@lukePeavey Unfortunately I no longer use Truecrypt, ever since official support for the software was abruptly discontinued in what seems a highly odd turn of events… Perhaps someday I’ll return to using it, but you should know that the software itself is no longer maintained.

In fact…

This problem is caused by TrueCrypt falling out of date with newer OS X systems, and it’s nothing to be worried about; rest assured that the script is _completely non-destructive_, and it will gently exit out if it detects something wrong or if the fix isn’t necessary. The code isn’t documented, but I can easily explain what’s going on: in a nutshell, Homebrew throws a fit because all of a sudden it expects these library files to be somewhere specific in TrueCrypt, and they aren’t.

Actually though, brew doctor is doing what it's supposed to do—diagnose everything from critical errors to tiny discrepancies (Homebrew is really smart software). TrueCrypt is just out of date, and all the script does is to move the files over _into_ TrueCrypt, to where Homebrew expects to find them. It then creates symbolic links _back to where they came from_, meaning your system effectively sees the files as being in two places now. I see no way for this to break TrueCrypt, but if anything goes wrong, you can obviously just remove the symlinks and put the library files back, reversing the whole process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.