, cocoa.
NSTask *changePerms = [[NSTask alloc] init];
[changePerms setLaunchPath:@"/bin/chmod"];
NSArray *chmodArgs = [NSArray arrayWithObjects:@"666", @"/Users/abc/hello.txt", nil];
[changePerms setArguments:chmodArgs];
[changePerms launch];
NSFileManager
NSDictionary* attr = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithShort:0766], NSFilePosixPermissions, NULL];
NSError *error = nil;
[[NSFileManager defaultManager] setAttributes:attr ofItemAtPath:@"/Users/abc/Desktop/test.txt" error:&error];
system()
system("chmod 777 /Users/abc/Desktop/test.txt");
, !