Colen
Colen

Reputation: 13918

How to programmatically make a folder on Mac OS world-writable?

For my mac os application, I'd like to make a folder it creates (under /Library/Application Support, or maybe somewhere else if that works better) world-writable. Anything else that gets added to that folder would also need to be world-writable. This way multiple users can use the same application without it having to make copies of some large files it uses for each one.

Is there a way to say "Make this folder readable and writable to everyone, and also all items in it, and also all items that will always be created in it" programatically? I don't want to affect just the files in the folder when the command happens - I want to make it affect every file that ever gets created under the folder.

Upvotes: 0

Views: 473

Answers (1)

Ken Aspeslagh
Ken Aspeslagh

Reputation: 11594

Sounds like you want to set your umask to 0 when programmatically writing to the folder and the files inside. With a 0 umask, files will be created 666 and directories 777. See man -s2 umask

Upvotes: 1

Related Questions