I've a file named config.properties in the var root folder. How do I edit this file and save it.
Every where it says to type this in terminal, it will open a text editor with admin access. But, its not opening for me
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit
I've searching for how to do this for some time and I'm really tired, not finding a solution. Can someone be kind enough to help me?
Just use something like that to open file in TextEdit:
sudo open -e /var/tmp/mobile_installation.log.0
Additionally you can use any other text editor which can work with file rights correctly. I prefer Fraise editor.
Related
I need all my files in certain directory to be accessible only by root. So I do the chown and chmod commands to set privileges to 700 template where file owner is root. After that if I open files with nano everything works ok: if I run it with sudo I can see contents of files and edit it; if not root then I can see just an empty file which I can't edit or modify. Then I try to open files with Sublime2 as subl 1.txt. With or without sudo it just appears to show an empty file. Then I try sudo open 1.txt to open with the default TextEditor and then I see a message that I don't have permissions. The same if I try anything like sudo open -a (any other text editor from my apps) 1.txt the permissions message is shown. I've tried to google for gksu for mac but people say that sudo is enough. Please guys, any ideas on the topic are welcome. Thank you much!
So complete newbie question, but I've googled it and tried all their suggestions and I can't get it to work still :(
Trying to learn about the terminal... so I've created two files on my Desktop - filea.txt, fileb.txt - when I try to run the cd command I get the error, "No such file or directory exists".
I'm in the Desktop so that isn't the problem.
Is there anyone who could please suggest anything I can try?
I appreciate the help, and am completely grateful to anyone who answers - I understand time is valuable.
Thank you!
On an ubuntu to change to Desktop, you should type cd ~/Desktop, now you are in the Desktop directory, now typing ls would should list your files and directories on your desktop. Now you can open your file on a text editing application such as gedit by typing gedit filea.txt, which would open the file filea.txt in the text editor.
If you're trying to change directory to desktop and it's giving you that error, try typing cd .. which goes back one directory, and repeat to go back as far as you can and then try changing directory to desktop again.
I've got a problem with Sublime Text 2 in that when I start it it automatically tries to load a file that leads it to crash.
I can see that there are ways of changing the settings once it's loaded - how do I fix it when it won't finish start-up?
I'm running on Mac OSX (Mavericks).
For Sublime 3
on Mac, Auto Save session exists in this path
~/Library/Application Support/Sublime Text 3/Local. Just go to this path delete all the files. Sublime will start working fresh.
On Linux, Auto Save session exists in /home/<USER>/.config/sublime-text-3/Local. Delete all the files you'll be good to go fresh.
On Windows the path is %APPDATA%\Sublime Text 3\Local
You can try hunting around for the file causing the error. However, I'd recommend reverting your install (link) though rather than deleting, I'd just move it somewhere temporarily. Be sure to move your User folder out. After reverting, move the User folder back. If you used package control, it will grab all of the installed plugins again. If you didn't you will need to move those back manually. If it's a particular file that's causing issues (not a plugin) then you could also edit the Session file. It's a bit more involved but can be found in Application Support/Sublime Text 2/Settings.
If you could post the file causing the issue, we could probably tell you how to fix put it back into a working state. If it's a settings file, it might be as simple as malformed json. I'm unsure though as you didn't give much detail on the actual error.
So, I deleted both the Session.sublime_session and the Auto Save Session.sublime_session in the Settings folder and that allowed me to get it to run and not crash on startup.
Delete Session.sublime_session from ~/Library/Application Support/Sublime Text 3/Local.
rm ~/Library/Application\ Support/Sublime\ Text\ 3/Local/Session.sublime_session
Also:
Please don't delete all content in the ~/Library/Application Support/Sublime Text 3/Local folder as this will also delete your Licence. #kushdilip (Tried to add this as a comment to your post but didn't have enough reputation to do so.)
I would recommend using another text editor (such as using vim in the terminal) to view/edit the files in:
~/Library/Application Support/Sublime Text 2/Packages/Default/Preferences.sublime-settings
There are two other directories, but Default is probably where you want to start.
~/Library/Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings
~/Library/Application Support/Sublime Text 2/Packages/Vintage/Preferences.sublime-settings
(Make a backup before changing any files around!)
For subline text 2 on my Mac:
There is no directory named Local under ~/Library/Application Support/Sublime Text 2/, but there is strange hidden file .DS_Store, I remove it and sublime text don't crash anymore!
$ rm .DS_Store
Sometimes when I create a file using vim some/path/newfile, vim lets me edit it, only to complain when I attempt to save my changes.
E212 Can't open file for writing.
This appears to happen only when the new file is located in a system directory.
:w! does not override this error.
How can I write the current buffer, without having to save it to a temporary location, exit, then rename it using sudo?
This will ask you for the root password, then save your changes as you requested:
:w !sudo tee %
Then type (L)oad at the prompt, to re-load the file after it is saved.
You can mkdir first, then save it.
Add this line to your .vimrc:
cmap w!! %!sudo tee > /dev/null
and then you can do
:w!!
when you get into this position, and it will write the file using sudo. Very handy.
You can avoid this problem by using "sudo" to start the editing session.
sudo vi name-of-file
If you want a robust, easy-to-remember solution and don't mind installing a plugin, try SudoEdit.vim - Edit Files using sudo or su or any other tool.
If this is the case in Windows 7 or later editions, run the VI editor as Administrator. Right Click of the application and select "Run as Administrator". This issue will be resolved. Moreover, the error is due to Administrative Privileges.
vim some/path/newfile
you can try to do it in two steps,first create the folder 'some' and 'path' by use mkdir ~ ;second you go into the 'path' folder,use the command:sudo vim newfile.then save it
Make sure the directory where you are trying to save the file exists and that you have permission to edit the file.
You can type :help message in Vim to get more information on this and other error messages. Try searching by typing /E212 once the docs come up. You can also view the documentation online at http://vimdoc.sourceforge.net/htmldoc/message.html and CTRL-F to find it.
For what it's worth, you may also want to ensure you have sufficient storage in the partition where you're attempting to save the file. I had to free up some space in my /home drive and that resolved the issue.
I know this is an old question, but this is what fixed it for me. Your file might be set to immutable meaning that you can't edit it.
You can check this with lsattr /path/to/file.txt
If it is use
chattr -i /etc/resolv.conf to make it no longer immutable.
Just had this issue outside of system directory.
When I tried to open a file vim src/help/tips.c. Turns out help directory did not exist, the directory was named differently and it was one of those very rare occasions that I did not auto-complete with Tab.
So, in conclusion, if this happens for a file that is not at a place where you may have permission issues, look if the path leading up to the file is a valid one.
I have experienced this in Kali!! The default account requires escalation to root with "sudo" in order for the file to be editable.
e.g: sudo vim / at this point all standard expectations appear to follow.
For some reason 2 of my files got locked and when I click the little lock icon in the upper right corner of the window it asks me if I would like to unlock, and doing so results in a "The file xxxx.h could not be unlocked" (Unlocking failed for an unknown reason). I have tried to restart Xcode, also tried to restart my machine with no help.
I am also unable to edit the files using BBEdit, I get the error "You do not have sufficient privileges to perform this operation (MacOS Error code: -5000)".
I'm running OS X Lion with Xcode 4.
Very strange as I have not made any changes to my system prior to this problem. Any help would be appreciated.
Open the file in any text editor. If the contents isn't text based you'll see a lot of gibberish. Ignore this, copy the contents. Open up a new text file. Paste the contents and save over the old file. This will copy just the contents of the file and ignore permissions.
What you're dealing with here is an ACL issue. If you ls -l the directory you'll see a little + on the end of the permission string:
drwxr-xr-x+ 4 eekyou staff 136 May 6 2011 eekyou.xcuserdatad
You can easily strip these off like so (in your project directory:
sudo chmod -R -E ./*
Hope this helps.
=]
The #eecue answer didn't help me. I user another Terminal command for complete removal of all ACL permissions:
sudo chmod -RN ./*
First check if the file is opened/locked by another program or user.
If it is not, the program probably crashed and failed to remove the flag, lookup the file and check with CMD+i if it is locked.
If it is not, permissions are probably wrong, so check the permission in the CMD+i dialog at the bottom, and apply them to everything in the enclosing folder (a .xcproject is a directory).
If this still doesn't work (like for me), there is a simple command line to unlock all files in a folder. ONLY do this if all the above steps have been checked / taken.
sudo chflags -R nouchg /Users/username/Development/GIT/MyProject
Replacing the project folder with your own project folder of course.
You may need to take ownership of the folder in which you wish to save your project. To do so, open up the console. Then type sudo chown $USER /path/to/your/project.