Py2app: Operation Not Permitted
Solution 1:
After I upgraded my operating system to OS X El Capitan (10.11.2), I got similar error when packaging my app using py2app:
***creating application bundle:MyApp***error: [Errno1] Operation not permitted:'/Users/jake/work/my-app/dist/MyApp.app/Contents/MacOS/MyApp'
I did some research and found a solution: 1) disable SIP; 2) remove restricted file flag on Python.framework. It worked for me.
Disable SIP
Restart your Mac.
Before OS X starts up, hold down Command+R and keep it held down until you see an Apple icon and a progress bar. Release. This boots you into Recovery.
From the Utilities menu, select Terminal.
At the prompt type the following:
csrutil status csrutil disable reboot
You can re-enable SIP by following the above steps, but using:
csrutil enable
References:
- http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/
- http://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html
Remove Restricted File Flag
sudo chflags -R norestricted /System/Library/Frameworks/Python.framework
As it's mentioned in https://forums.developer.apple.com/thread/6987
Solution 2:
I had the same problem. Instead of running
python setup.py py2app
I tried
python3 setup.py py2app
and it worked just fine. Hope this helps.
Solution 3:
Don't use the system provided py2app. Running this fixed the issue for me:
pip install --user--ignore-installed py2app
(I'm usually wary of things that require me to disable System Integrity Protection)
Solution 4:
This doesn't happen if you build and install your own py2app rather than depending on the OS-bundled one.
Inside your virtualenv, install Mercurial (if needed), then:
pip install hg+https://bitbucket.org/ronaldoussoren/py2app/
py2app
should then work without issue.
Solution 5:
Answer : Install with -U
flag!
Since all of you will have installed py2app already, start by uninstalling it.
pip3 uninstall py2app
After this point, it's crucial that you reinstall it using the -U
flag! 📦
pip3 install -U py2app
py2applet --make-setup YourApp.py
python3 setup.py py2app -A
Look in your dist/
folder, there should now be a runnable application.
Then you can rebuild it using python3 setup.py py2app
Verified on OS X Catalina, Mojave, Big Sur
Post a Comment for "Py2app: Operation Not Permitted"