Closed millisami closed 13 years ago
hi!
you need to have the header files for libmagic on your system for ruby-filemagic to be compiled. i'm not too familiar with os x, but you should get those when you install xcode.
hth jens
Well, thanx for the reply.
I made it work by installing libmagic
via brew and it works.
But how can I get the extension?
Following is code and it works:
require 'filemagic'
require 'pp'
f = FileMagic.new
pp f.file("/Users/millisami/rubygems/spec/fixtures/not_csv_file.jpg")
pp f.file "/Users/millisami/rubygems/spec/fixtures/csv_input.csv"
And the result is:
"JPEG image data, JFIF standard 1.01"
"ASCII text"
But how can I get the extension of the file?
can you tell me what result you would have expected in each case? what do you mean by "extension"?
the same error on osx ruby 2.2.2
when use
brew install libmagic
then it is OK
For installing ruby-filemagic version 0.6.3 on OSX
env ARCHFLAGS="-arch x86_64" gem install -v 0.6.3 ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/
Hi, I tried to install the gem but it blowed up with the native dependency. ree-1.8.7-2010.02 [~/gitcodes/httparty (master)] ➔ gem install ruby-filemagic Building native extensions. This could take a while... ERROR: Error installing ruby-filemagic: ERROR: Failed to build gem native extension.
What do I have to install first? I am on Mac OS X.