Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install libmagic on Mac OS X via homebrew
$ brew install libmagic
$ brew link libmagic (if the link is already created is going to fail, don't worry about that)
$ env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/
@wzehui
Copy link

wzehui commented Apr 15, 2019

bingo! Thanks!

@mane-sandeep
Copy link

mane-sandeep commented Jun 8, 2019

+1

@jdieg0
Copy link

jdieg0 commented Aug 7, 2019

Perfect. Thanks! brew install libmagic did it.

@amirasaran
Copy link

amirasaran commented Sep 29, 2019

Awesome thanks.

@tatarurzvn
Copy link

tatarurzvn commented Feb 28, 2020

Thank you 🌮 Saved my day

@Shellbye
Copy link

Shellbye commented Apr 22, 2020

Work like a charm

@sksankarraj
Copy link

sksankarraj commented May 24, 2020

Thanks man!

@d-kahara
Copy link

d-kahara commented Jun 5, 2020

Thanks!! 👍🏾

@chuaweijie
Copy link

chuaweijie commented Jun 21, 2020

Thank you very much!

@remino
Copy link

remino commented Jul 14, 2021

On macOS Big Sur 11.4, I had to do the following instead of the last line above:

gem install ruby-filemagic -v '0.7.2' --source 'https://rubygems.org/' -- --with-magic-include=/opt/homebrew/include --with-magic-lib=/opt/homebrew/lib/

@uvaist1997
Copy link

uvaist1997 commented Aug 17, 2021

thanks

@kwilczynski
Copy link

kwilczynski commented Aug 3, 2022

If folks that come here have issues with the also excellent ruby-filemagic Ruby Gem, there exists ruby-magic Ruby Gem too, which has a bit more active development.

One can install it as a pre-built (native) Ruby Gem or as usual, in which case it should use bundled libmagic (as an alternative for requiring a system-wide or external one present).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment