Pycharm cannot get permission to control Excel(Mac)


Dear all

I want to use "xlwings" to control Excel, but I got error because I didn't get permission. However, pycharm didn't ask me the permission like other IDE used to.

For example, when I run the sample code below, MacOX will ask me "spyder want to contol..." I tried this in terminal as well, MacOX aksed me same thing. But pycharm didn't, just show error like below.

anyone has same problem?

(I have tried same things in Windows version pycharm , if successful)




I believe this is the same issue: Unfortunately, there's no workaround an the moment.

0 is the same issue...

I thought it was a new bug. it surprise me the bug still not fixed...2 months..


2020.1 seems to have fixed this


Dear All,

I have just tried to use the same "xlwings" python lib, but still doesn't work. I was googling a debugging for a day (looked for Issue 1146, Issue 1262, Issue 1266)  it works (and asks for the correct permission) in iTerm2, Terminal, but does not work from PyCharm Console. I tried also the following command in Terminal:

tccutil reset AppleEvents

as well as I reinstalled PyCharm but nothing has changed.


Basic run code:

import xlwings as xw

app = xw.Book()


The error message is the following:

Traceback (most recent call last):
File "/usr/local/anaconda3/lib/python3.8/site-packages/aeosa/appscript/", line 482, in __call__
return, params, atts, codecs=self.AS_appdata).send(timeout, sendflags)
File "/usr/local/anaconda3/lib/python3.8/site-packages/aeosa/aem/", line 92, in send
raise EventError(errornum, errormsg, eventresult)
aem.aemsend.EventError: Command failed: The user has declined permission. (-1743)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/anaconda3/lib/python3.8/site-packages/IPython/core/", line 3437, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-4bab09758204>", line 1, in <module>
runfile('/Volumes/GoogleDrive/My Drive/Code/Python/python-home-kezdo/', wdir='/Volumes/GoogleDrive/My Drive/Code/Python/python-home-kezdo')
File "/Applications/", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/Applications/", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Volumes/GoogleDrive/My Drive/Code/Python/python-home-kezdo/", line 6, in <module>
app = xw.Book()
File "/usr/local/anaconda3/lib/python3.8/site-packages/xlwings/", line 557, in __init__
impl =
File "/usr/local/anaconda3/lib/python3.8/site-packages/xlwings/", line 3812, in add
return Book(impl=self.impl.add())
File "/usr/local/anaconda3/lib/python3.8/site-packages/xlwings/", line 203, in add
File "/usr/local/anaconda3/lib/python3.8/site-packages/xlwings/", line 110, in visible
return'System Events').processes[its.unix_id ==].visible.get()[0]
File "/usr/local/anaconda3/lib/python3.8/site-packages/aeosa/appscript/", line 518, in __call__
raise CommandError(self, (args, kargs), e, self.AS_appdata) from e
appscript.reference.CommandError: Command failed:
OSERROR: -1743
MESSAGE: The user has declined permission.
COMMAND: app('/System/Library/CoreServices/System').processes[its.unix_id == 80947].visible.get()

I'm using the following configuration:

PyCharm 2021.1.1
Python 3.8.5 (with Anaconda)
xlwings 0.23.0
MacOS 10.15.7 (Catalina)

I've seen both PyCharm and VS Code fix this and break this again depending on the release. A workaround is always to start PyCharm from the Terminal. It's easiest to set an alias like this in your ~/.zshrc (or ~/.bash_profile on older macOS):

alias pycharm=/Applications/

This allows you to start PyCharm from the Terminal by typing:


Thank you Felix, it works in this way.


Yes, it works. Thanks!!


I'm having a permission issue with the workaround. Any suggestions?


zsh: permission denied: /Users/cotani/Applications/JetBrains Toolbox/PyCharm Professional Edition for Apple



Hello @C Otani, 


Could you please submit an issue on  with attached:

1. code example

2. steps to reproduce

3. logs folder zipped from ***Help | Collect logs and Diagnostic Data*** 





Please sign in to leave a comment.