Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCC.db protected by SIP in Sierra #18

Closed
avivais opened this issue Sep 3, 2016 · 30 comments
Closed

TCC.db protected by SIP in Sierra #18

avivais opened this issue Sep 3, 2016 · 30 comments
Assignees

Comments

@avivais
Copy link

avivais commented Sep 3, 2016

Was this tested on Sierra latest beta?

@avivais
Copy link
Author

avivais commented Sep 3, 2016

Just tried - Seems as now TCC.db is protected by SIP - It is now readonly

@jacobsalmela jacobsalmela changed the title Sierra Beta TCC.db protected by SIP in Sierra Sep 12, 2016
@jacobsalmela
Copy link
Owner

Yeah, I was seeing this, too. Not sure there will be a great way around it besides disabling SIP...

@avindra
Copy link

avindra commented Jan 17, 2017

Error is:

Traceback (most recent call last):
  File "./tccutil.py", line 294, in <module>
    main()
  File "./tccutil.py", line 284, in main
    enable(item)
  File "./tccutil.py", line 232, in enable
    c.execute("UPDATE access SET allowed='1' WHERE client='%s'" % (client))
sqlite3.OperationalError: attempt to write a readonly database

@keyurp1987
Copy link

Any updates on the issue above? We have been hit with the same issue and wondering if anyone found a workaround to get pass this and set the accessibility via command line.

@jacobsalmela
Copy link
Owner

I personally have not bothered trying to circumvent SIP and don't plan to. I like SIP despite some headaches it can cause for traditional ways of doing things.

Ideally, it would be nice if Apple were to implement this open source software as part of their OS. They already have there own tccutil--they just need to add the functionality my tool offers (plus some Apple engineering to safely work with SIP)...The whole reason I made this to begin with is because Apple's tccutil only has one command, which just resets everything; it seems like a perfect opportunity to merge the two utilities.

@Tatsh
Copy link

Tatsh commented Feb 11, 2018

I have my database modified since I did this before SIP existed, yet SIP protects the file. Perhaps it is possible to go into SIP-less mode, update the file, and then turn it back on?

I have not tried this yet as I have not needed to yet. The entries for bash, tmux, sh, etc all show up in Accessibility. And also there are these defaults keys which have full paths, either file or directory:

defaults write com.apple.universalaccessAuthWarning /usr/libexec -bool true
defaults write com.apple.universalaccessAuthWarning /usr/libexec/sshd-keygen-wrapper -bool true

I have not tried to add an entry this way but I am already fairly certain it will not work because otherwise this utility would not exist.

@jacobsalmela
Copy link
Owner

Isn't a reboot necessary in order to enable/disable SIP? I've been out of the Mac world for a couple of years now so I'm not familiar with what the defaults commands you mentioned do.

@Tatsh
Copy link

Tatsh commented Feb 11, 2018

Yes a reboot is required. You have to get into recovery mode, disable SIP, come back, edit, go back to recovery mode, and maybe it will work. I have not tried this and yes it's annoying but at least it keeps SIP enabled.

@jacobsalmela
Copy link
Owner

I suppose a notice could be added to the utility about SIP and this possible workaround--at the very least.

@Tatsh
Copy link

Tatsh commented Jul 30, 2018

This is no longer an issue on Mojave. macOS 10.14 will have a section named Automation under Security & Privacy / Privacy. This utility is no longer necessary at that point. Any app that attempts to use automation will bring up a prompt to confirm once.

@jacobsalmela
Copy link
Owner

Interesting..I guess that's good because I don't have time to maintain it anymore. Thanks @Tatsh

@paulz
Copy link

paulz commented Aug 30, 2018

works for me with sudo on MacOS X High Sierra:

sudo tccutil -l
/usr/bin/osascript
com.apple.AccessibilityInspector
com.apple.Automator
com.apple.Safari
com.apple.ScriptEditor.id.disconnectHardwareKeyboard
com.apple.ScriptEditor2
com.apple.Terminal
com.apple.dt.Xcode
com.apple.dt.Xcode-Helper
com.apple.sample.UIElementInspector
com.getdropbox.dropbox
com.google.GoogleTalkPluginD
com.screenhero.screenhero
net.sourceforge.sqlitebrowser
sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G65

@ccstone
Copy link

ccstone commented Sep 1, 2018

sudo tccutil -l is a read command.

What happens when you use a writable command?

@ssbarnea
Copy link

ssbarnea commented Dec 29, 2018

Clearly it does not work on Mojave:

$ sudo tccutil -l                                                                                                                                                                           Error opening Database.

Any workarounds as I really need to bless osascript?

@Ge0rges
Copy link

Ge0rges commented Feb 1, 2019

sudo tccutil.py --list yields Error opening Database. on macOS Mojave 10.14.2. Is it related to SiP?

@Tatsh
Copy link

Tatsh commented Feb 1, 2019

Yes

@jacobsalmela
Copy link
Owner

I'll add some more info in the message to let users know about SIP

@danielbayley
Copy link
Contributor

danielbayley commented Mar 14, 2020

@jacobsalmela Could you cut a new release (including #32)? So that the @Homebrew formula can be updated… for those with SIP disabled.

@jacobsalmela
Copy link
Owner

I've been meaning to, but I haven't made time to learn all their rules for updating a formula. When I first did it, it wasn't a super easy process.. I'll give it my best, but if anyone has a quick and dirty version of commands to run, let me know.

@jacobsalmela
Copy link
Owner

Never mind. It's quite easy with an existing formula in place:

v1.2.6 is now available via Homebrew. 😄

@danielbayley
Copy link
Contributor

danielbayley commented Mar 16, 2020

I've been meaning to, but I haven't made time to learn all their rules for updating a formula. When I first did it, it wasn't a super easy process.. I'll give it my best, but if anyone has a quick and dirty version of commands to run, let me know.

@jacobsalmela Ah I would have handled the PR to Homebrew… as I deal with formulae/casks quite a lot! Just needed the release… But yeah it should be much easier to update as opposed to creating new. Nice one, thanks 👍🏼

@LeoGrin
Copy link

LeoGrin commented Jul 8, 2020

Hi,

I'm on Mojave 10.14.6. When I try to use tccutil, I get :

sudo tccutil --list
Error opening Database.  You probably need to disable SIP for this to work.

However, I've disabled SIP:

csrutil status
System Integrity Protection status: disabled.

Thus I'm wondering if SIP is the real problem here. Thank you in advance for your help.

@jacobsalmela
Copy link
Owner

Hmmm. Thanks for the note. There might be more work to do then...

@Squactopus
Copy link

Squactopus commented Aug 4, 2020

What does SIP even stand for?
Update: looked it up, and now I know what it stands for. This information does not help at all.

@paulz
Copy link

paulz commented Aug 4, 2020

About System Integrity Protection on your Mac

https://support.apple.com/en-us/HT204899

@jacobsalmela
Copy link
Owner

Yeah, it basically prevents tools like this from hacking their way into things we know nothing about. It's a good thing 😄 .

@mike-myers-tob
Copy link

Hi,

I'm on Mojave 10.14.6. When I try to use tccutil, I get :

sudo tccutil --list
Error opening Database.  You probably need to disable SIP for this to work.

However, I've disabled SIP:

csrutil status
System Integrity Protection status: disabled.

Thus I'm wondering if SIP is the real problem here. Thank you in advance for your help.

I've noticed that you can access TCC.db even with SIP enabled, if you grant Full Disk Access to Terminal.app and then open the TCC.db with sqlite3. Note: tested with macOS 11 Big Sur.

@jacobsalmela
Copy link
Owner

That makes sense and is a good solution for this issue I think--assuming you're comfortable doing it. Thanks for the note!

@Tatsh
Copy link

Tatsh commented Nov 23, 2020

Hi,
I'm on Mojave 10.14.6. When I try to use tccutil, I get :

sudo tccutil --list
Error opening Database.  You probably need to disable SIP for this to work.

However, I've disabled SIP:

csrutil status
System Integrity Protection status: disabled.

Thus I'm wondering if SIP is the real problem here. Thank you in advance for your help.

I've noticed that you can access TCC.db even with SIP enabled, if you grant Full Disk Access to Terminal.app and then open the TCC.db with sqlite3. Note: tested with macOS 11 Big Sur.

Access, but are you able to write to it?

@jacobsalmela
Copy link
Owner

I'm moving this into a Discussion.

#44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests