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

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.

Related

How Disable Locked Files in 8.1 without encryption key

I delete my unity project which has a .git folder and ask me to create an encryption key I don't know why it asks me to do that, now when I try to add files in git it refuses to add any things and it prompts this error
The file will have its original line endings in your working directory
error: open("Temp/UnityLockfile"): Permission denied
error: unable to index file 'Temp/UnityLockfile'
fatal: adding files failed
Any suggestion
In general the Temp folder is one of the things you do NOT want to be under version control! It should be ignored as mentioned by the first comment! Use this .gitignore file in the root folder of your git project!
Also see Cleaning up and Migrating existing Unity project into new one or another PC where I explained it a bit more in detail and also how to copy your project with only the necessary files.
As said if there is no such file yet simply create it, otherwise adopt the content accordingly.
Also refer to How can I make Git "forget" about a file that was tracked, but is now in .gitignore?.
In your specific case here the error itself is caused because you currently have your project opened in Unity.
In that case there is the - as the name says - LOCK file which ensures you cannot open the same project twice in a second Unity instance.
This file is locked/owned by the Unity Editor process itself and therefore can't be overwritten/accessed by git at the same time.
Now if for some reason after adding the .gitignore file mentioned above this issue still persists you can close Unity, manually delete the Temp folder, make your git merge and reopen Unity.

How do I read from a folder in the user's home directory from an Xcode Source Editor Extension?

I created an Xcode Source Editor Extension. I'd like to build a linting command, for example. The user's existing lint file is located in a location like /Users/Tim/CalculatorApp/swiftlint.yml.
If I try to use try! String(contentsOfFile: "/Users/Tim/CalculatorApp/swiftlint.yml"), I get the error:
Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=257 "The file “.swiftlint.yml” couldn’t be opened because you don’t have permission to view it."
This is most likely because the extension is running in a sandbox and doesn't have permission to read files under the user's home directory. I tried removing the sandbox from the Extension's target, but then the extension doesn't load at all.
I get the error:
Could not attach to pid : “3623”
attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries when the attached failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)
If I re-add the App Sandbox, clean the project, then run again, I no longer get this error. This leads me to believe that Xcode Extensions might need to be run in App Sandbox mode.
Is there a way to run an Xcode Extension without App Sandbox mode?
Are there any other workarounds for how to allow the Xcode extension to read the file in question? I was thinking about using the "User Selected File" permission, but I don't see how that would work with an Extension which has no UI.
Any other thoughts for how to get something like this to work?

Unable to modify permissions of folders on Mac (Mojave)

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

Xcode Can't Commit Files to Github

I am trying to commit to my local repository but it keeps saying "The working copy “Project” failed to commit files.
warning: unable to access '/Users/me/.config/git/attributes': Permission denied"
I tried this Unable to access 'git/attributes'
It worked for a while but after about an hour of working on my project the error comes back.
I don't know if this is related but some storyboard files are randomly marked for Deletion (with the D beside their file name) when trying to commit.
Sicne that .config folder is supposed to be owned by the user, check, whenever you see again this error:
the new owner of that .config folder (to see of it is root)
the process running at that time (like a local BitBucket server running as root),
or your command history (to see if it involved a command like sudo htop)

Why do I get a Windows file permission error (IO Error 13) with Android SDK when writing to files starting with a dot?

Running Titanium Appcelerator 0.8.1 on a Windows XP Virtual Machine, with Android SDK 2.1
When running build/install app, getting the following error (last line broken for display here):
[TRACE] f = open(os.path.join(dest, dest_file), "w")
[TRACE] IOError: [Errno 13] Permission denied:
'C:\\Documents and Settings\\firstname.surname\\Desktop\\MyApp\\build\\android\\.classpath'
Removing .classpath results in .classpath being created, but the error simply moves onto the next file it has to write to.
The files are in a git repository, checked out via msysgit, but the same error occurs when the files are copied directly from the git server to the Windows machine. Unfortunately the Titanium dev app won't rebuild the Android package for an existing app if the build\android files are missing, so it's not possible just to not check these into git.
The files appear to have the correct permissions - are writable by the current user account, don't have the read-only flag set (checked via 'attrib'), and have set the access options and owner via the Security/Advanced dialogues on the files and directories (and checked by a Windows IT admin here)
As far as I can tell, nothing else has the file open (a possible cause of IOError 13).
What could be the reason here? Could Git be the culprit?
Answering my own question in case anyone else gets the same issue:
removing the hidden flag (with attrib -H) fixes the file permission problem.
(the Hidden flag was set by msysgit, to match the 'hidden' nature of dotfiles in Unix)

Resources