How to stop Sublime Text 2 crashing on startup - macos

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

Related

PATH related issues

A couple of days ago, I added code to my Mac's PATH to make some newly installed programs work properly on my machine. Unfortunately, it seems I have messed it up somewhere because some additional lines are printed every time I open my terminal.
Here is a screenshot of my terminal:
And here is a screenshot of my PATH Variable:
Does anyone know how I can remove extra lines in my terminal?
Thanks in advance
I renamed my ~/.zshrc file to ~/.zshrc2. Then all the extra lines were not shown anymore while opening up my terminal. Now I am sure the problems belong somewhere in my ~/.zshrc file
You can rename a folder by entering this command mv old-name-folder new-name-folder in the folder's directory.

OS X, How to edit a file in var/root folder

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.

Make the user package point to somewhere else with sublime text

I'm using Sublime text, and I'm sharing some snippets with coworkers. I would like to be abble to directly make sublime text go to this folder to find the snippets.
Do you know any good ways of doing it ?
create a share folder with your team (say /mnt/shared/snippets)
symlink that folder to your Sublime folder
ln -s /mnt/shared/snippets "~/Library/Application Support/Sublime Text 3/User/"
restart Sublime and it should pick up the snippets

Windows incorrectly copying files by filename when in a Special Folder

If I copy a file from a special folder to the clipboard, change the location that special folder points to, and try to paste the file to this new location, Windows complains with a Item Not Found error, seemingly trying to copy the file by the filename alone.
The way I change the special folder location is with this line of C++ code:
SHSetKnownFolderPath(FOLDERID_Desktop, 0, NULL, new_location);
And a refresh to see the effect immediately:
SHChangeNotify(0x8000000, 0x1000, NULL, NULL);
Steps to reproduce
Desktop pointing to C:\Users\BoppreH\Desktop
Copy the file music 1.mp3 from the Desktop (C:\Users\BoppreH\Desktop\music 1.mp3)
Change location of the Desktop special folder to D:\music
The Desktop now shows the musics from D:\music
Try to paste music 1.mp3 on the Desktop
It fails with Item Not Found, complaining it could not find the file at D:\music\music 1.mp3, when the file is still happily sitting at C:\Users\BoppreH\Desktop\music 1.mp3. If I paste the file in any other folder that is not the Desktop, it works fine.
I know this is a case of Doctor, it hurts when I do this, and that constantly changing the location of the Desktop is extremely unusual behavior, but this is a feature I've grown to love and this bug constantly bites me.
Is there some workaround for this issue?
Use some type of folder watcher control to detect when the Special Folders location has changed and check the clipboard for any file paths that refer to the old location and update them.
Or change the location of the Specials before you copy the file.

Unable to unlock file for editing in Xcode 4?

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.

Resources