Wednesday, December 9, 2009

Working with system files in OSX

Have you ever been doing any sort of file interaction - opening, editing - and all of a sudden, you get a nasty STOP error. "Unable to access file, permissions unavailable" - this is your computer telling you, this may harm your system if you access it! The solution? Prove to the computer your not stupid. You want to tell it to give you "root-access" to the file system. If your a mac lover like myself, you'll be glad to hear that theres a solution to errors such as "Must have root access to modify file" *Click* 

The hometown hero in this case, is sudo. A four letter word is the solution to those awe struck moments, staring at an error with no suggested solution. The word sudo is written inline with the command, for example:

sudo /path/ProgramToEditWith/ (note: there is a space b/w the two paths) /filepath/filename.ext

Take note, there are many other things that can be done with sudo, as I like to say, google it!



Useful commands:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /filepath/filename.ext
The command 'sudo' will allow a user to act as a superuser/root, upon submission of password. The user will use TextEdit to edit selected file path, with root privileges. Note: There is a space between the two paths

sudo cp /path/file.ext /newpath/filename.ext
In this case, the user is also given root privileges, but not to open a file, but copy it. This may overwrite the file, or create a new one, in the same directory or a new one.

No comments: