# Wkhtml2pdf permission denied and Operation not permitted

**URL:** <https://forum.xojo.com/t/wkhtml2pdf-permission-denied-and-operation-not-permitted/67460>\
**Category:** macOS\
**Created:** [December 16, 2021, 2:58pm UTC](https://forum.xojo.com/t/wkhtml2pdf-permission-denied-and-operation-not-permitted/67460 "2021-12-16T14:58:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Cox](https://forum.xojo.com/user_avatar/forum.xojo.com/david_cox/32/227_2.png) [@David\_Cox](https://forum.xojo.com/u/David_Cox)\
**Post date:** [December 16, 2021, 2:58pm UTC](https://forum.xojo.com/t/wkhtml2pdf-permission-denied-and-operation-not-permitted/67460/1 "2021-12-16T14:58:50Z")

</div>

I have used wkhtml2pdf on macOS, Windows and Linux for Desktop and Web for years, but now I’m building the app for the MAS, I’m having trouble with wkhtml2pdf in the macOS sandbox.

I embed wkhtml2pdf into my macOS app, but when I run from there it via Shell it is now returning with an ErrorCode 126 Permission Denied.

So I thought I needed to make a copy of wkhtml2pdf into my ApplicationData folder. When I run this copy I get an ErrorCode 126 Operation not permitted. After copying it I use a ‘chmod +x …’ command to ensure it is executable.

Here is my Shell command:  
`/Users/davidcox/Library/Containers/com.bambamsoftware.bambambilling/Data/Library/Application\ Support/Helpers/local/bin/wkhtmltopdf --page-size A4 --load-error-handling ignore --enable-smart-shrinking --margin-top 10 --margin-bottom 10 --encoding UTF8 --orientation Portrait file:///Users/davidcox/Library/Containers/com.bambamsoftware.bambambilling/Data/Library/Application%20Support/BamBam%20Billing/Downloads/2021-12-16_14-46-29/ReportFile_2021-12-16_14-46-29.html /Users/davidcox/Library/Containers/com.bambamsoftware.bambambilling/Data/Library/Application\ Support/BamBam\ Billing/Downloads/2021\-12\-16_14\-46\-29/BamBam\ Billing\ Export\ 2021\-12\-16\ 14\-46\-29.PDF`

And here is the result:  
`bash: /Users/davidcox/Library/Containers/com.bambamsoftware.bambambilling/Data/Library/Application Support/Helpers/local/bin/wkhtmltopdf: Operation not permitted`

How am I supposed to run a ‘foreign’ helper application from within my sandboxed macOS application?

---

<div class="post-metadata">

**Author:** ![David\_Cox](https://forum.xojo.com/user_avatar/forum.xojo.com/david_cox/32/227_2.png) [@David\_Cox](https://forum.xojo.com/u/David_Cox)\
**Post date:** [December 16, 2021, 5:06pm UTC](https://forum.xojo.com/t/wkhtml2pdf-permission-denied-and-operation-not-permitted/67460/2 "2021-12-16T17:06:44Z")

</div>

I think it is a **Shell vs Terminal** issue since this command works fine in Terminal, but fails in Shell:

`/Users/davidcox/Desktop/Helpers/local/bin/wkhtmltopdf /Users/davidcox/Desktop/Test.html /Users/davidcox/Desktop/Test.pdf`

Any ideas on how to get Shell to run wkhtmltopdf within a macOS Xojo app? It has worked fine for years.

---

<div class="post-metadata">

**Author:** ![KarenA](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/c89c15/32.png) [@KarenA](https://forum.xojo.com/u/KarenA)\
**Post date:** [December 16, 2021, 5:12pm UTC](https://forum.xojo.com/t/wkhtml2pdf-permission-denied-and-operation-not-permitted/67460/3 "2021-12-16T17:12:23Z")

</div>

Maybe a privilege level issue?

Maybe you need to use sudo ? (PS I don’t really know what I am talking about- just guessing from things I’ve read in general)

-Karen

---

<div class="post-metadata">

**Author:** ![David\_Cox](https://forum.xojo.com/user_avatar/forum.xojo.com/david_cox/32/227_2.png) [@David\_Cox](https://forum.xojo.com/u/David_Cox)\
**Post date:** [December 16, 2021, 7:12pm UTC](https://forum.xojo.com/t/wkhtml2pdf-permission-denied-and-operation-not-permitted/67460/4 "2021-12-16T19:12:08Z")

</div>

Thanks for the idea, I added a sudo to the front of the command, but it still said Operation not permitted. It seems that Shell is no longer allowed to launch apps in Monterey.

---

<div class="post-metadata">

**Author:** ![KarenA](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/c89c15/32.png) [@KarenA](https://forum.xojo.com/u/KarenA)\
**Post date:** [December 16, 2021, 7:23pm UTC](https://forum.xojo.com/t/wkhtml2pdf-permission-denied-and-operation-not-permitted/67460/5 "2021-12-16T19:23:02Z")

</div>

See this link. It may be useful

> **[r/MacOS - \[Monterey\] Launching a binary without terminal](https://www.reddit.com/r/MacOS/comments/qh43v9/monterey_launching_a_binary_without_terminal/)**
>
> 0 votes and 2 comments so far on Reddit

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [December 16, 2021, 7:54pm UTC](https://forum.xojo.com/t/wkhtml2pdf-permission-denied-and-operation-not-permitted/67460/6 "2021-12-16T19:54:55Z")

</div>

I think the app must be in your app bundle and signed with same team.  
You may check in apples documentation for how to run helper.
