Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Im getting 'Error: PDF could not be generated! Bad CPU type in executable' on my m1 macbook

I have tests with wicked_pdf and wkhtmltopdf-binary. Both gems are installed, but errors dont go away :( Im tried to install gems with Rosetta, but nothing helps me

error is here

Minitest::UnexpectedError:
       RuntimeError: Failed to execute:
       ["/Users/larkin/.rvm/gems/ruby-2.7.2/bin/wkhtmltopdf", "--lowquality", "--footer-center", "конфіденційно", "--footer-left", "Служба етичного контролю", "--footer-right", "[page] / [topage]", "--footer-font-size", "10", "file:////var/folders/sk/3493jp896vj_spzzn_z2zvkm0000gn/T/wicked_pdf20211129-63903-gn9oc5.html", "/var/folders/sk/3493jp896vj_spzzn_z2zvkm0000gn/T/wicked_pdf_generated_file20211129-63903-urbrlu.pdf"]
       Error: PDF could not be generated!
        Command Error: /Users/larkin/.rvm/gems/ruby-2.7.2/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf:50:in `exec': Bad CPU type in executable - /Users/larkin/.rvm/gems/ruby-2.7.2/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf_macos_carbon (Errno::EBADARCH)
        from /Users/larkin/.rvm/gems/ruby-2.7.2/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf:50:in `<top (required)>'
        from /Users/larkin/.rvm/gems/ruby-2.7.2/bin/wkhtmltopdf:23:in `load'
        from /Users/larkin/.rvm/gems/ruby-2.7.2/bin/wkhtmltopdf:23:in `<main>'
        from /Users/larkin/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `eval'
        from /Users/larkin/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `<main>'
like image 720
Volodymyr Larkin Avatar asked Oct 21 '25 04:10

Volodymyr Larkin


1 Answers

The installation/update of Rosetta (on MacOS Monterey 12.2) solved this issue for me with the following command :

softwareupdate --install-rosetta

Maybe it can help others

like image 157
SLgz Avatar answered Oct 23 '25 01:10

SLgz