Skip to content

An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue. #162

Open

Description

@anupamkakade
An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue.
Make sure that `gem install mimemagic -v '0.3.10' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 6.1.3, which depends on
    actionmailbox was resolved to 6.1.3, which depends on
      activestorage was resolved to 6.1.3, which depends on
        marcel was resolved to 0.3.3, which depends on
          mimemagic

Anybody seeing this issue ?
Can you help me fix this.
This issue is occurring after I installed ruby 3.0.1 via rvm

Activity

  1. jgengo commented on May 3, 2021

    @jgengo

    @anupamkakade Do you have more logs below or it's all you received?!

  2. carlosgomez2 commented on May 5, 2021

    @carlosgomez2

    Same problem here, seems to be related to Apple M1 chipset, doing:

    $ gem install mimemagic -v '0.3.10' --source 'https://rubygems.org/'
    ERROR: Error installing mimemagic:
    ERROR: Failed to build gem native extension.
    ...
    checking host system type... Invalid configuration arm64-apple-darwin20': machine arm64-apple' not recognized
    configure: error: /bin/sh ./config.sub arm64-apple-darwin20 failed

  3. carlosgomez2 commented on May 5, 2021

    @carlosgomez2

    Perhaps I was wrong, sorry my first day in a mac environment, I just do brew install shared-mime-info and again try to install with gem install mimemagic -v '0.3.10' --source 'https://rubygems.org/', then it just run fine.

    log for reference.

    `current directory: /Users/rasalghul/.gem/gems/mimemagic-0.4.3/ext/mimemagic
    /Users/rasalghul/.rbenv/versions/2.6.5/bin/ruby -rrubygems /Users/rasalghul/.gem/gems/rake-13.0.3/exe/rake RUBYARCHDIR=/Users/rasalghul/.gem/extensions/-darwin-20/2.6.0/mimemagic-0.4.3 RUBYLIBDIR=/Users/rasalghul/.gem/extensions/-darwin-20/2.6.0/mimemagic-0.4.3
    Ignoring nio4r-2.5.7 because its extensions are not built. Try: gem pristine nio4r --version 2.5.7
    rake aborted!
    Could not find MIME type database in the following locations: ["/usr/local/share/mime/packages/freedesktop.org.xml", "/opt/homebrew/share/mime/packages/freedesktop.org.xml", "/opt/local/share/mime/packages/freedesktop.org.xml", "/usr/share/mime/packages/freedesktop.org.xml"]

    Ensure you have either installed the shared-mime-info package for your distribution, or
    obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location
    of that file.
    /Users/rasalghul/.gem/gems/mimemagic-0.4.3/ext/mimemagic/Rakefile:15:in locate_mime_database' /Users/rasalghul/.gem/gems/mimemagic-0.4.3/ext/mimemagic/Rakefile:26:in block in <top (required)>'
    /Users/rasalghul/.gem/gems/rake-13.0.3/exe/rake:27:in `

    '
    Tasks: TOP => default
    (See full trace by running task with --trace)

    rake failed, exit code 1`

  4. yevhene commented on May 13, 2021

    @yevhene

    UPD: issue disappeared when I unset bundle path to vendor/bundle.

    Same here. Ruby 3.0.1 (via rvm), Linux, Ubuntu 20.04.2 LTS. shared-mime-info is installed.

    ...
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    
    current directory:
    /home/user/work/myproj/vendor/bundle/ruby/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic
    /home/user/.rvm/rubies/ruby-3.0.1/bin/ruby -I/home/user/.rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0
    -rrubygems /home/user/work/myproj/vendor/bundle/ruby/3.0.0/gems/rake-12.3.3/exe/rake
    RUBYARCHDIR\=/home/user/work/myproj/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/mimemagic-0.3.10
    RUBYLIBDIR\=/home/user/work/myproj/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/mimemagic-0.3.10
    rake aborted!
    ArgumentError: wrong number of arguments (given 2, expected 1)
    /home/user/work/myproj/vendor/bundle/ruby/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:43:in
    `block in <top (required)>'
    /home/user/work/myproj/vendor/bundle/ruby/3.0.0/gems/rake-12.3.3/exe/rake:27:in
    `<main>'
    Tasks: TOP => default
    (See full trace by running task with --trace)
    
    rake failed, exit code 1
    
    Gem files will remain installed in
    /home/user/work/myproj/vendor/bundle/ruby/3.0.0/gems/mimemagic-0.3.10 for inspection.
    Results logged to
    /home/user/work/myproj/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/mimemagic-0.3.10/gem_make.out
    
    An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue.
    Make sure that `gem install mimemagic -v '0.3.10'` succeeds before bundling.
    
  5. atsheehan commented on Jun 3, 2021

    @atsheehan

    I ran into this issue as well and was able to resolve it by upgrading rake to v13.

    I could reproduce the issue with the following Gemfile:

    source 'https://rubygems.org'
    
    gem 'rake', '~> 12.3'
    gem 'rails', '6.1.0'
    

    When I ran bundle with the --path argument, I got the following error:

    $ bundle install --path=vendor/bundle
    ...
    Installing mimemagic 0.3.10 with native extensions
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    
        current directory: $DIR/vendor/bundle/ruby/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic
    $HOME/.rbenv/versions/3.0.0/bin/ruby -I$HOME/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -rrubygems $DIR/vendor/bundle/ruby/3.0.0/gems/rake-12.3.3/exe/rake
    RUBYARCHDIR\=$DIR/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/mimemagic-0.3.10 RUBYLIBDIR\=$DIR/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/mimemagic-0.3.10
    rake aborted!
    ArgumentError: wrong number of arguments (given 2, expected 1)
    $DIR/vendor/bundle/ruby/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:43:in `block in <top (required)>'
    $DIR/vendor/bundle/ruby/3.0.0/gems/rake-12.3.3/exe/rake:27:in `<main>'
    Tasks: TOP => default
    (See full trace by running task with --trace)
    
    rake failed, exit code 1
    
    Gem files will remain installed in $DIR/vendor/bundle/ruby/3.0.0/gems/mimemagic-0.3.10 for inspection.
    Results logged to $DIR/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/mimemagic-0.3.10/gem_make.out
    
    An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue.
    Make sure that `gem install mimemagic -v '0.3.10' --source 'https://rubygems.org/'` succeeds before bundling.
    
    In Gemfile:
      rails was resolved to 6.1.0, which depends on
        actionmailbox was resolved to 6.1.0, which depends on
          activestorage was resolved to 6.1.0, which depends on
            marcel was resolved to 0.3.3, which depends on
              mimemagic
    

    Removing the rake ~> 12.3 restriction upgraded it to 13 and it worked after that.

  6. ChrisBAshton commented on Mar 25, 2022

    @ChrisBAshton

    I ran brew install shared-mime-info but mimemagic still couldn't find it because Homebrew installed it in a different place to what was expected. I had to run:

    cp /opt/homebrew/Cellar/shared-mime-info/2.1/share/shared-mime-info/packages/freedesktop.org.xml /opt/homebrew/share/mime/packages/
    

    Then the bundle install worked 👍

  7. clebio commented on Apr 19, 2022

    @clebio

    The trace shows

    
    Ensure you have either installed the shared-mime-info package for your distribution, or
    obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location
    of that file.
    

    So, as an alternative to the previous comment here, you can
    export FREEDESKTOP_MIME_TYPES_PATH=$(brew --prefix)/Cellar/shared-mime-info/2.1/share/shared-mime-info/packages/freedesktop.org.xml

  8. loqman commented on Oct 23, 2023

    @loqman

    Ruby 3.2.2
    Rails 6.1.7.6

    Downgraded mimemagic to 0.3.8 and the issue was fixed.

    gem 'mimemagic', '0.3.8'
    
  9. baston1 commented on Feb 6, 2024

    @baston1

    I had the same issue, I have the following in my project:

    • Ruby 2.7.1
    • Rails 6.0.4
    • MacBook Pro Apple M3 with macOs Sonoma 14.3
      I fixed with brew install shared-mime-info and then bundle install
  10. scaustin34 commented on Apr 8, 2024

    @scaustin34

    I had the same issue, I have the following in my project:

    • Ruby 2.7.1
    • Rails 6.0.4
    • MacBook Pro Apple M3 with macOs Sonoma 14.3
      I fixed with brew install shared-mime-info and then bundle install

    This worked for me with Ruby 2.6.3, Rails 5.2.4, M3 14.4.1

  11. added a commit that references this issue on Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions