Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sldsnk

macrumors member
Original poster
Jun 22, 2005
42
25
I created a simple shortcut that prompts me for the number of copies I want to print along with the paper type. It then runs an "lpr" command in ZSH using the "Run Shell Script" action in Shortcuts. The shortcut worked fine until I updated to Sonoma. Now I get an "Operation Not Permitted" error:
Screenshot 2023-09-29 at 18.18.21.png

I verified that "lpr" command still works in the terminal and I'm able to print. I've tried the following with no luck:
- Tried different Macs (M2 Pro Mac mini, M1 Pro MBPRo, M2 MBP Air)
- In the security settings I gave full disk access to: lpr, zsh, bash and the Shortcuts app
- Reset the shortcut privacy settings
- Tried running the shortcut on files in my downloads folder and documents folder
- Searched the web and forums for a solution

Edit: it seems the issue is caused by having spaces in the file's path. I tried replacing the spaces with "\ " and it didn't work. Will keep trying!

Any help is appreciated.

Here's a screenshot of my Run Shell Command, I build a string using the file's path along with a predetermined lpr command to print to my printer and set media type.
Screenshot 2023-09-29 at 18.18.09.png
 
Last edited:

bogdanw

macrumors 603
Mar 10, 2009
5,695
2,729
Some suggestions:
- use the full path for lpr - /usr/bin/lpr
- try with quotes for ‘Canon_Printer’ and ‘CNImediaType=68’
 

matt_and_187_like_this

macrumors 6502a
Dec 8, 2015
543
1,895
I have a similar issue activing a pip virtual environment. Same error since Sonoma. I re-installed the virtual environment and it worked again, until the error came back. So I'm guessing it's a bug? Have you found a solution?
 

matt_and_187_like_this

macrumors 6502a
Dec 8, 2015
543
1,895
I found this on reddit: (worked for me)
"Found workaround: add to Services menu quick actions instead. You can even set global shortcut like Cmd+Ctrl+<A-Z> that way. Works fine and doesn't require any permissions."
 

sldsnk

macrumors member
Original poster
Jun 22, 2005
42
25
thanks to everyone who replied. I didn't find a solution and i'v been using the workaround of adding the shortcut to services menu. It works just fine from the services menu but I do miss the quick action in the finder
 

anga

macrumors newbie
Nov 2, 2023
1
1
Hi! I had the same issue with a shortcurt, but in my case it was "cp" instead of "lpr".
For me allowing Finder Full Disc Access did the trick (as stupid as it sounds, because Finder obviously has Full Disc Access anyways, but it is what it is).

I followed this tutorial, maybe it solves your issue too. Hope this helps.
 
  • Like
Reactions: sldsnk

sldsnk

macrumors member
Original poster
Jun 22, 2005
42
25
Hi! I had the same issue with a shortcurt, but in my case it was "cp" instead of "lpr".
For me allowing Finder Full Disc Access did the trick (as stupid as it sounds, because Finder obviously has Full Disc Access anyways, but it is what it is).

I followed this tutorial, maybe it solves your issue too. Hope this helps.
Thank you! This fixed it for me! Its weird how the finder doesn't have full disk access as far as system settings is concerned.

It took me a minute to find the Finder to add it to the Full Disk Access preferences,, if you need locating it here's where you can find it:

Macintosh HD/System/Library/CoreServices/Finder
 
  • Like
Reactions: anga

matt_and_187_like_this

macrumors 6502a
Dec 8, 2015
543
1,895
Didn't work for me and still haven't found a solution besides using services menu. It's only the one in a python virtual environment that doesn't work anymore. All the other command line programs still run fine.
 

Slartibart

macrumors 68030
Aug 19, 2020
2,892
2,597
Didn't work for me and still haven't found a solution besides using services menu. It's only the one in a python virtual environment that doesn't work anymore. All the other command line programs still run fine.
Can you described this in more detail? Which VM, python, etc.?
 

matt_and_187_like_this

macrumors 6502a
Dec 8, 2015
543
1,895
Can you described this in more detail? Which VM, python, etc.?

it's a tool installed with pip in a regular python virtual environment (python3 -m venv)

The shortcut was working fine, but broke after updating to Sonoma. It still works in the services menu, but no longer in the menu bar.

Already tried everyone I know. Reinstalling it, redoing the virtual environment, rewriting the shortcut. I even got it to work once, but then it failed again.

The first action of the shell script in shortcuts is to activate the venv with "source ~/documents/xyz/bin/activate", which already doesn't happen.

The odd thing is that I have other shortcuts with shell scripts that use homebrew apps and these run perfectly fine from the menu bar.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.