Unable to modify permissions of folders on Mac (Mojave) - macos

I am new to Macs and I am trying to run some interesting stats on my iMessages using the code runner extension on VSCode. I've been following this post: https://towardsdatascience.com/heres-how-you-can-access-your-entire-imessage-history-on-your-mac-f8878276c6e9
However, when I run the line conn = sqlite3.connect('/Users/<username>/Library/Messages/chat.db')
I get the error sqlite3.OperationalError: unable to open database file
Based off what I can tell my issue is that VScode doesn't have the right permissions to access the ~/Library/Messages folder and possibly the chat.db as well. First, I ran ls -l on Library and the result is drwx---rwx for Messages. So I tried to use both chmod a+rwx Messages and sudo chmod a+rwx Messages to open permissions to everything but got the error chmod: Unable to change file mode on Messages: Operation not permitted both times.
Am I doing something wrong and/or is there a better way to do this? Or is it just not possible to change the permissions of this folder?

After some more creative searching I discovered that it was an Issue with Mojave's System Integrity Protection (SIP) and can be solved by giving the desired apps full disk access in Settings>Security&Privacy>Privacy>FullDiskAccess.
Solution found here

Related

Error: Bundler does not have write access to create a temp directory

When trying to run bundle install on a ruby project I received the following error:
There was an error while trying to write to `Bundler does not have write access
to create a temp directory within C:/Users/Simon/AppData/Local/Temp. Bundler
must have write access to your systems temp directory to function properly. `.
It is likely that you need to grant write permissions for that path.
I've checked the permissions in my temp folder and everything looks OK. Is there another possible cause of this error?
After much frustration, I discovered that this is actually a misleading error message. The actual error is Errno::EACCES which can be caused by several things: a file permissions error, or by a network connection permissions issue such as a firewall.
I my case, it was my firewall, TinyWall, that was blocking ruby.exe from connecting to the internet and thus causing this error. By giving it access through the firewall, bundle install ran successfully.
Just putting this out there for anyone else that may encounter this frustrating issue one day.

Fail to load files

I had issue with one Mac app, my college and developer of app don't have this issue.
MacOS 10.15.5, i can't load more than 122 files as group. If add one file as 123 app can't load. It showed by random way *** fail to open, this file is fine.
I reinstalled new macos, issue doesn't solve it.
Here is log file of app: lines normal like first one, the others many lines like second one.
Found dictionary:/Users/**/Downloads/pro/****, added to list
Open file failed, reason:No such file or directory
Open file failed, reason:No such file or directory
Open file failed, reason:Too many open files
Open file failed, reason:Too many open files
Fail to load dict:/Users/**/Downloads/pro/*****, Error:Fail to open file
Files is ok, if i opened only one file is ok.
The issue only when loading all files together as group.
I appreciate for helping.
App link
When you the folder of dict contain many files. If less than 122, it works fine like charm. But if add 123 or more, app can't load any thing. “Failed to open ***”, this file not corrupt, the issue with app.
My friend don't have this issue. My mac now has new system, i reinstalled.
The problem related to limit open file by system.
Solution:
sudo launchctl limit maxfiles 65536 200000
And then open app.
The best solution:
ref: https://wilsonmar.github.io/maximum-limits/
Download this two file: https://github.com/wilsonmar/mac-setup/blob/master/configs/limit.maxfiles.plist
https://github.com/wilsonmar/mac-setup/blob/master/configs/limit.maxproc.plist
Copy and Paste this two file in folder /Library/LaunchDaemons/
In terminal write this code:
sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl load -w /Library/LaunchDaemons/limit.maxproc.plist
Enter, will ask for user password.
In terminal, write:
sudo ulimit -n 65536 200000
Restart, i will work like a charm! Enjoy

Can't create/save any new files in VSCode on Mac Catalina and keep getting a read-only file system error

Failed to save 'Untitled-1': Unable to write file (Unknown (FileSystemError): Error: EROFS: read-only file system, open '/Untitled-1.html')
I believe the issue you’re running into is you’re trying to create files in the root (/) directory. One of the changes Apple made when they released Catalina was that the root directory is Read-Only, which explains the error you’re seeing.
The reason for this is enhanced security and you can read more about it here. I would recommend you change to your home (~/) directory and make all of your files in there. This should take care of all file system errors you’re currently experiencing.

Fix file permissions on a Mac

I'm having a weird behaviour on my mac. I got some files from another computer, and for some reason the system can't identify the user related to some permissions. Here is a pic of what I get on the finder permission manager —is in Spanish, but I'm pretty sure that in English would be very similar—
Basically, what it says, is:
obtaining… writing and reading
admin writing and reading
munchausen (Me) writing and reading
wheel writing and reading
everyone writing and reading
So is like it can't find the name of a user, which makes sense, because this files had permissions for an user that doesn't exist in this computer.
How can I clean this permissions? From the folder, I tried with:
sudo chmod -R 754 .
It gave proper permissions, but didn't solved the problem of the obtaining… thing.
Any idea?

Wireshark - you don't have permission to capture on that device mac

I installed Wireshark and during the installation it showed an error but the installation itself completed. When I ran the program and tried to capture packets on my network, it showed this error:
I'm new to mac so i don't even know how to properly ask.
Could someone help me?
According to User: gmale's answer on ask.wireshark.org, he solved his problem in this way and I'm sure that it could solve yours as well. It says:
1- Open Terminal
To see your exact user name (for me that was AliGht)
2- Type 'whoami'
3- execute the following commands:
cd /dev
sudo chown AliGht:admin bp*
and enter your computer password:
4- now type this command:
ls -la | grep bp
The last command will display a list of files such as:
5- Make sure all of them have your user name and admin as the user/group. For some reason, the last one didn't get assigned properly so I had to run the command:
sudo chown AliGht:admin bpf4
so the last command fixed my problem as you see in the last image:
Done!
If your WireShark is open then close it and open it again.
All credits of this tutorial goes to user gmale on ask.wireshark.org,
If you want to open WireShark always as administrator then take a look to another post which I created a shortcut for it via Applescript, and this is the only way which you can open the WireShark always as administrator even when you turn off/on your mac.
I don't know how to solve this problem, but if you want a temporary fix, you can use the following command:
$ sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
Wireshark provides the solution itself, along with the explanation of weird secrets:
add your user to the group "access_bpf" by commanding
sudo dseditgroup -o edit -a `whoami` -t user access_bpf
then launch Wireshark's script
sudo "/Library/Application Support/Wireshark/ChmodBPF/ChmodBPF";
That's all, because (as the script explains):
# Unfortunately, macOS's devfs is based on the old FreeBSD
# one, not the current one, so there's no way to configure it
# to create BPF devices with particular owners or groups. BPF
# devices on macOS are also non-cloning, that is they can
# be created on demand at any time. This startup item will
# pre-create a number of BPF devices, then make them owned by
# the access_bpf group, with permissions rw-rw----, so that
# anybody in the access_bpf group can use programs that capture
# or send raw packets.
If you want to open WireShark always as administrator I suggest to use AppleScript:
Open AppleScript: By pressing cmd+space and write AppleScript Editor in the Spotlight Search as picture below:
Then from File --> Choose NEW
In the open window write:
do shell script "/Applications/Wireshark.app/Contents/MacOS/Wireshark" ¬
with administrator privileges user name "username" password "password"
Change the "username" and "password" with yours. If you don't know your username in terminal write "whoami" to see your username, password is your computer password!.
Mine is look like this:
Now export your script as Application, by going to --> File --> Export , and change File Format to Application write a name for your file and Save it on your desktop like following pictures:
DONE now run your App from Desktop, and by this way your WireShark runs always by Admin Permission.
I have faced the same problem in MacOS High Sierra (v10.13.6). I have clean-up all dependency files and folders but nothing works for me.
Using the terminal, if I run the following command then it is working -
sudo chmod o+r /dev/bpf*
sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
This should work.
Run the application from the terminal with the following command:
User$ **sudo Wireshark**
Wireshark should open and packet capture should work then.
Was having same issue with install and run permissions etc. Attempted a few of the above mentioned fixes and although they would come back with the desired result program still would not run properly even with uninstall/install in addition.Getting a bit overwhelmed with it not working after several remedies being attempted I came to one that was super simple and worked -
I simply set up/checked log in as root user. Here you can enable/disable root user account, enable log in account and change root password. So I just switched profiles from my Admin account to the Root account. (I am honestly not sure if its safe to do it this way, so thinking many of you have far more knowledge on this than me I'd appreciate your comments on that!) Also my understanding is that you cannot properly run sudo commands if root account is enabled - So probably just tuning it off if it were on would suffice, but I wanted a quick and easy install at that point. The steps are really easy:
support.apple.com/en-us/HT204012
Then just switch user accounts to root -Log in with "other" then type root and your password.
Now just install Wireshark and it should install and run properly!
**I don't think I would stay in root account after install.
Hope maybe this will help some!
I got same issue and then notice below document provide solution already.
https://www.wireshark.org/docs/wsug_html_chunked/ChBuildInstallOSXInstall.html
2.5. Installing Wireshark under macOS
The official macOS packages are distributed as disk images (.dmg) containing the application bundle. To install Wireshark simply open the disk image and drag Wireshark to your /Applications folder.
In order to capture packets, you must install the “ChmodBPF” launch daemon. You can do so by opening the Install ChmodBPF.pkg file in the Wireshark .dmg or from Wireshark iself by opening Wireshark → About Wireshark selecting the “Folders” tab, and double-clicking “macOS Extras”.
The installer package includes Wireshark along with ChmodBPF and system path packages. See the included Read me first.html file for more details.
I do not want to modify my folder permissions on my system device files like the accepted answer, but I was able to get permissions by opening Wireshark like this:
sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
Bonus, you can add an alias to your ~/.zshrc:
alias ws="sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark"
Now execute the file: (or you can open a new terminal window)
source ~/.zshrc
Open wireshark with super user permissions:
ws

Resources